Skip to content

Commit

Permalink
Merge pull request #11 from aemino/dart2_compat
Browse files Browse the repository at this point in the history
Dart 2 compatibility
  • Loading branch information
thosakwe authored Jun 30, 2018
2 parents 297d206 + 3a2cbfa commit f54ee03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions lib/src/modifier_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ModifierBuilder get modify => new ModifierBuilder();

class ModifierBuilder{

Map map = {};
Map<String, dynamic> map = {};

toString() => "ModifierBuilder($map)";

void _updateOperation(String operator, String fieldName, value) {
Map opMap = map[operator];
Map<String, dynamic> opMap = map[operator];
if (opMap == null) {
opMap = {};
opMap = <String, dynamic>{};
map[operator] = opMap;
}
opMap[fieldName] = value;
Expand Down
24 changes: 12 additions & 12 deletions lib/src/selector_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ SelectorBuilder get where => new SelectorBuilder();
class SelectorBuilder {
static final RegExp objectIdRegexp =
new RegExp(".ObjectId...([0-9a-f]{24})....");
Map map = {};
Map<String, dynamic> map = {};
bool _isQuerySet = false;
Map get _query {
Map<String, dynamic> get _query {
if (!_isQuerySet) {
map['\$query'] = {};
map['\$query'] = <String, dynamic>{};
_isQuerySet = true;
}
return map['\$query'];
}

int paramSkip = 0;
int paramLimit = 0;
Map paramFields;
Map<String, dynamic> paramFields;

String toString() => "SelectorBuilder($map)";

_addExpression(String fieldName, value) {
Map exprMap = {};
Map<String, dynamic> exprMap = {};
exprMap[fieldName] = value;
if (_query.isEmpty) {
_query[fieldName] = value;
Expand All @@ -31,7 +31,7 @@ class SelectorBuilder {
}
}

_addExpressionMap(Map expr) {
_addExpressionMap(Map<String, dynamic> expr) {
if (_query.containsKey('\$and')) {
List expressions = _query['\$and'];
expressions.add(expr);
Expand All @@ -44,14 +44,14 @@ class SelectorBuilder {

void _ensureParamFields() {
if (paramFields == null) {
paramFields = {};
paramFields = <String, dynamic>{};
}
}

void _ensureOrderBy() {
_query;
if (!map.containsKey("orderby")) {
map["orderby"] = new LinkedHashMap();
map["orderby"] = <String, dynamic>{};
}
}

Expand Down Expand Up @@ -136,7 +136,7 @@ class SelectorBuilder {

SelectorBuilder inRange(String fieldName, min, max,
{bool minInclude: true, bool maxInclude: false}) {
Map rangeMap = {};
Map<String, dynamic> rangeMap = {};
if (minInclude) {
rangeMap["\$gte"] = min;
} else {
Expand All @@ -163,14 +163,14 @@ class SelectorBuilder {

SelectorBuilder sortByMetaTextScore(String fieldName) {
_ensureOrderBy();
map["orderby"][fieldName] = {'\$meta': "textScore"};
map["orderby"][fieldName] = <String, dynamic>{'\$meta': "textScore"};
return this;
}

SelectorBuilder hint(String fieldName, {bool descending: false}) {
_query;
if (!map.containsKey("\$hint")) {
map["\$hint"] = new LinkedHashMap();
map["\$hint"] = <String, dynamic>{};
}
int order = 1;
if (descending) {
Expand Down Expand Up @@ -254,7 +254,7 @@ class SelectorBuilder {
return this;
}

SelectorBuilder raw(Map rawSelector) {
SelectorBuilder raw(Map<String, dynamic> rawSelector) {
map = rawSelector;
return this;
}
Expand Down

0 comments on commit f54ee03

Please sign in to comment.