MapStyleSpec.fromJson constructor
Create object from the given JSON data.
Implementation
MapStyleSpec.fromJson(Map<String, dynamic> json) {
bool isPropertySet = false;
if (json['elementType'] != null) {
elementType = json['elementType'].toString();
isPropertySet = true;
}
if (json['featureType'] != null) {
featureType = json['featureType'].toString();
isPropertySet = true;
}
if (json['stylers'] != null) {
if (json['stylers'] is List<dynamic>) {
List<dynamic> stylersArray = json['stylers'];
for (Map<String, dynamic> item in stylersArray) {
MapStyler styler = MapStyler.fromJson(item);
stylers!.add(styler);
isPropertySet = true;
}
} else {
Util.showWarning("`stylers` should be an object of List<dynamic>");
}
}
if (!isPropertySet) {
Util.showWarning(
"No valid properties found in given map for MapStyleSpec.");
}
}