Index: pkg/serialization/lib/src/basic_rule.dart |
diff --git a/pkg/serialization/lib/src/basic_rule.dart b/pkg/serialization/lib/src/basic_rule.dart |
index 19a8bcab3c63f059edae35a827df76855c1c1d04..fe9428f2f347ab0301e8d5c6dc15e5d7874c44f7 100644 |
--- a/pkg/serialization/lib/src/basic_rule.dart |
+++ b/pkg/serialization/lib/src/basic_rule.dart |
@@ -130,12 +130,19 @@ class BasicRule extends SerializationRule { |
useMaps = false; |
} |
- /** Create either a list or a map to hold the object's state, depending |
+ /** |
+ * Create either a list or a map to hold the object's state, depending |
* on the [useMaps] variable. If using a Map, we wrap it in order to keep |
* the protocol compatible. See [configureForLists]/[configureForMaps]. |
+ * |
+ * If a list is returned, it is growable. |
*/ |
- createStateHolder() => |
- useMaps ? new _MapWrapper(fields.contents) : new List(fields.length); |
+ createStateHolder() { |
+ if (useMaps) return new _MapWrapper(fields.contents); |
+ List list = []; |
+ list.length = fields.length; |
+ return list; |
+ } |
/** |
* Wrap the state if it's passed in as a map, and if the keys are references, |