BitmapDescriptor.fromJson constructor
The inverse of .toJson.
Implementation
// TODO(stuartmorgan): Remove this in the next breaking change.
@Deprecated('No longer supported')
BitmapDescriptor.fromJson(Object json) : _json = json {
assert(_json is List<dynamic>);
final List<dynamic> jsonList = json as List<dynamic>;
assert(_validTypes.contains(jsonList[0]));
switch (jsonList[0]) {
case _defaultMarker:
assert(jsonList.length <= 2);
if (jsonList.length == 2) {
assert(jsonList[1] is num);
final num secondElement = jsonList[1] as num;
assert(0 <= secondElement && secondElement < 360);
}
break;
case _fromBytes:
assert(jsonList.length == 2);
assert(jsonList[1] != null && jsonList[1] is List<int>);
assert((jsonList[1] as List<int>).isNotEmpty);
break;
case _fromAsset:
assert(jsonList.length <= 3);
assert(jsonList[1] != null && jsonList[1] is String);
assert((jsonList[1] as String).isNotEmpty);
if (jsonList.length == 3) {
assert(jsonList[2] != null && jsonList[2] is String);
assert((jsonList[2] as String).isNotEmpty);
}
break;
case _fromAssetImage:
assert(jsonList.length <= 4);
assert(jsonList[1] != null && jsonList[1] is String);
assert((jsonList[1] as String).isNotEmpty);
assert(jsonList[2] != null && jsonList[2] is double);
if (jsonList.length == 4) {
assert(jsonList[3] != null && jsonList[3] is List<dynamic>);
assert((jsonList[3] as List<dynamic>).length == 2);
}
break;
default:
break;
}
}