Skip to content

Commit

Permalink
Added recursive parameter to JsonObject.fromMap
Browse files Browse the repository at this point in the history
This parameters allows for opting out of recursive parsing of the JsonObject value. Default behaviour is not changed.
  • Loading branch information
stevenroose committed Oct 28, 2014
1 parent 43f8e9f commit 3324435
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/json_object.dart
Expand Up @@ -105,10 +105,14 @@ class JsonObject<E> extends Object implements Map, Iterable {

/** An alternate constructor, allows creating directly from a map
* rather than a json string.
*
* If [recursive] is true, all values of the map will be converted
* to [JsonObject]s as well. The default value is [true].
*/
JsonObject.fromMap(Map map) {
JsonObject.fromMap(Map map, [bool recursive = true]) {
_objectData = map;
_extractElements(_objectData);
if(recursive)
_extractElements(_objectData);
isExtendable = false;
}

Expand Down

0 comments on commit 3324435

Please sign in to comment.