decodeData function
Implementation
@visibleForTesting
dynamic decodeData(MapEntry entry) {
switch (entry.key) {
case 'stringValue':
case 'doubleValue':
case 'timestampValue':
case 'booleanValue':
case 'geoPointValue':
case 'referenceValue':
return entry.value;
case 'integerValue':
return int.parse(entry.value);
case 'arrayValue':
return decodeArrayData(entry.value);
case 'mapValue':
return decodeMapData(entry.value);
case 'nullValue':
return null;
default:
throw Exception('Cannot convert this value to a json readable format. '
'That sound like this value type ${entry.key} is not supported by firestore.\nReceived data ${entry.value}');
}
}