decode static method
Implementation
static FillLayer decode(String properties) {
var map = json.decode(properties);
if (map["layout"] == null) {
map["layout"] = {};
}
if (map["paint"] == null) {
map["paint"] = {};
}
return FillLayer(
id: map["id"],
sourceId: map["source"],
sourceLayer: map["source-layer"],
minZoom: map["minzoom"]?.toDouble(),
maxZoom: map["maxzoom"]?.toDouble(),
visibility: map["layout"]["visibility"] == null
? Visibility.VISIBLE
: Visibility.values.firstWhere((e) => e
.toString()
.split('.')
.last
.toLowerCase()
.contains(map["layout"]["visibility"])),
fillSortKey: map["layout"]["fill-sort-key"] is num?
? (map["layout"]["fill-sort-key"] as num?)?.toDouble()
: null,
fillAntialias: map["paint"]["fill-antialias"] is bool?
? map["paint"]["fill-antialias"] as bool?
: null,
fillColor: (map["paint"]["fill-color"] as List?)?.toRGBAInt(),
fillOpacity: map["paint"]["fill-opacity"] is num?
? (map["paint"]["fill-opacity"] as num?)?.toDouble()
: null,
fillOutlineColor:
(map["paint"]["fill-outline-color"] as List?)?.toRGBAInt(),
fillPattern: map["paint"]["fill-pattern"] is String?
? map["paint"]["fill-pattern"] as String?
: null,
fillTranslate: (map["paint"]["fill-translate"] as List?)
?.map<double?>((e) => e.toDouble())
.toList(),
fillTranslateAnchor: map["paint"]["fill-translate-anchor"] == null
? null
: FillTranslateAnchor.values.firstWhere((e) => e
.toString()
.split('.')
.last
.toLowerCase()
.contains(map["paint"]["fill-translate-anchor"])),
);
}