Skip to content Skip to sidebar Skip to footer

Dart: Decode Json From A Firebase Snapshot

it's probably a trivial question, I try to decode a json from a Firebase snapshot, here is the structure of the json : firebaseKey1 : {img1:value1} firebaseKey2 : {img2:value2} f

Solution 1:

You don't need to json.decode. The returned value is already decoded.

{key1:value1}

is the result of

final Map<String,dynamic> value = {'key1': 'value1'};
print(value.toString());

Solution 2:

Maybe what the OP is looking for is:

var parsedJSON  = snapshot.value;
print('img1 : ' + parsedJSON['img1']);

Post a Comment for "Dart: Decode Json From A Firebase Snapshot"