From 3a2cbfa3c82496c728aa8f177e1ddcb17daa2c5f Mon Sep 17 00:00:00 2001 From: aemino Date: Wed, 30 May 2018 17:32:48 -0700 Subject: [PATCH] Dart 2 compatibility --- lib/src/modifier_builder.dart | 6 +++--- lib/src/selector_builder.dart | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/src/modifier_builder.dart b/lib/src/modifier_builder.dart index 3662717..9bb52fd 100644 --- a/lib/src/modifier_builder.dart +++ b/lib/src/modifier_builder.dart @@ -5,14 +5,14 @@ ModifierBuilder get modify => new ModifierBuilder(); class ModifierBuilder{ - Map map = {}; + Map map = {}; toString() => "ModifierBuilder($map)"; void _updateOperation(String operator, String fieldName, value) { - Map opMap = map[operator]; + Map opMap = map[operator]; if (opMap == null) { - opMap = {}; + opMap = {}; map[operator] = opMap; } opMap[fieldName] = value; diff --git a/lib/src/selector_builder.dart b/lib/src/selector_builder.dart index 739b93d..2801c87 100644 --- a/lib/src/selector_builder.dart +++ b/lib/src/selector_builder.dart @@ -5,11 +5,11 @@ SelectorBuilder get where => new SelectorBuilder(); class SelectorBuilder { static final RegExp objectIdRegexp = new RegExp(".ObjectId...([0-9a-f]{24})...."); - Map map = {}; + Map map = {}; bool _isQuerySet = false; - Map get _query { + Map get _query { if (!_isQuerySet) { - map['\$query'] = {}; + map['\$query'] = {}; _isQuerySet = true; } return map['\$query']; @@ -17,12 +17,12 @@ class SelectorBuilder { int paramSkip = 0; int paramLimit = 0; - Map paramFields; + Map paramFields; String toString() => "SelectorBuilder($map)"; _addExpression(String fieldName, value) { - Map exprMap = {}; + Map exprMap = {}; exprMap[fieldName] = value; if (_query.isEmpty) { _query[fieldName] = value; @@ -31,7 +31,7 @@ class SelectorBuilder { } } - _addExpressionMap(Map expr) { + _addExpressionMap(Map expr) { if (_query.containsKey('\$and')) { List expressions = _query['\$and']; expressions.add(expr); @@ -44,14 +44,14 @@ class SelectorBuilder { void _ensureParamFields() { if (paramFields == null) { - paramFields = {}; + paramFields = {}; } } void _ensureOrderBy() { _query; if (!map.containsKey("orderby")) { - map["orderby"] = new LinkedHashMap(); + map["orderby"] = {}; } } @@ -136,7 +136,7 @@ class SelectorBuilder { SelectorBuilder inRange(String fieldName, min, max, {bool minInclude: true, bool maxInclude: false}) { - Map rangeMap = {}; + Map rangeMap = {}; if (minInclude) { rangeMap["\$gte"] = min; } else { @@ -163,14 +163,14 @@ class SelectorBuilder { SelectorBuilder sortByMetaTextScore(String fieldName) { _ensureOrderBy(); - map["orderby"][fieldName] = {'\$meta': "textScore"}; + map["orderby"][fieldName] = {'\$meta': "textScore"}; return this; } SelectorBuilder hint(String fieldName, {bool descending: false}) { _query; if (!map.containsKey("\$hint")) { - map["\$hint"] = new LinkedHashMap(); + map["\$hint"] = {}; } int order = 1; if (descending) { @@ -254,7 +254,7 @@ class SelectorBuilder { return this; } - SelectorBuilder raw(Map rawSelector) { + SelectorBuilder raw(Map rawSelector) { map = rawSelector; return this; }