Implementation
static BackgroundLayer decode(String properties) {
var map = json.decode(properties);
if (map["layout"] == null) {
map["layout"] = {};
}
if (map["paint"] == null) {
map["paint"] = {};
}
return BackgroundLayer(
id: map["id"],
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"])),
backgroundColor: (map["paint"]["background-color"] as List?)?.toRGBAInt(),
backgroundOpacity: map["paint"]["background-opacity"]?.toDouble(),
backgroundPattern: map["paint"]["background-pattern"],
);
}