MapData.fromMap constructor
MapData.fromMap( - dynamic mapDataMap
)
Implementation
factory MapData.fromMap(dynamic mapDataMap){
final latitude = mapDataMap["latitude"] as double;
final longitude = mapDataMap["longitude"] as double;
final latitude_delta = mapDataMap["latitude_delta"] as double;
final longitude_delta = mapDataMap["longitude_delta"] as double;
final snippet = Map<String, dynamic>.from(mapDataMap["snippet"]);
final minzoom = snippet["minzoom"] as num;
final maxzoom = snippet["maxzoom"] as num;
final maxbounds = snippet["maxbounds"] as dynamic;
final usetags = snippet["usetags"] as dynamic;
final tagsoverlap = snippet["tagsoverlap"] as bool?;
return _instance = MapData(
id: mapDataMap["id"] as int,
style: snippet["tilesstyle"] as String,
minZoom: minzoom.toInt(),
maxZoom: maxzoom.toInt(),
bounds: BBox.named(
lng1: longitude - longitude_delta,
lat1: latitude - latitude_delta,
lng2: longitude + longitude_delta,
lat2: latitude + latitude_delta),
maxBounds: snippet.containsKey("maxbounds")
? maxbounds != null
? BBoxExtension.fromMap(maxbounds)
: null
: null,
useTags: snippet.containsKey("usetags")
? usetags != null
? UseTags.fromMap(usetags)
: null
: null,
tagsOverlap: tagsoverlap
);
}