decode static method

SlotLayer decode(
  1. String properties
)

Implementation

static SlotLayer decode(String properties) {
  var map = json.decode(properties);
  if (map["layout"] == null) {
    map["layout"] = {};
  }
  if (map["paint"] == null) {
    map["paint"] = {};
  }
  return SlotLayer(
    id: map["id"],
    minZoom: map["minzoom"]?.toDouble(),
    maxZoom: map["maxzoom"]?.toDouble(),
    slot: map["slot"],
    visibility: map["layout"]["visibility"] == null
        ? Visibility.VISIBLE
        : Visibility.values.firstWhere((e) => e.name
            .toLowerCase()
            .replaceAll("_", "-")
            .contains(map["layout"]["visibility"])),
    visibilityExpression: _optionalCastList(map["layout"]["visibility"]),
    filter: _optionalCastList(map["filter"]),
  );
}