TileLayer.fromJson constructor
TileLayer.fromJson(
- Map<String, dynamic> json
)
Implementation
TileLayer.fromJson(Map<String, dynamic> json) {
height = double.tryParse(json['height'].toString()) ?? 0.0;
width = double.tryParse(json['width'].toString()) ?? 0.0;
encoding = json['encoding'];
compression = json['compression'];
if (encoding == 'base64') {
final base64Raw = base64Decode(json['data']);
switch (compression) {
case 'zlib':
data = ZLibDecoder().decodeBytes(base64Raw);
break;
case 'gzip':
data = GZipDecoder().decodeBytes(base64Raw);
break;
default:
data = _base64decode(base64Raw); // #base64 -> int
}
} else {
data = json['data'].cast<int>();
}
setParamsFromJson(json);
}