decode static method

LocationIndicatorLayer decode(
  1. String properties
)

Implementation

static LocationIndicatorLayer decode(String properties) {
  var map = json.decode(properties);
  if (map["layout"] == null) {
    map["layout"] = {};
  }
  if (map["paint"] == null) {
    map["paint"] = {};
  }
  return LocationIndicatorLayer(
    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"]),
    bearingImage: _optionalCast(map["layout"]["bearing-image"]),
    bearingImageExpression: _optionalCastList(map["layout"]["bearing-image"]),
    shadowImage: _optionalCast(map["layout"]["shadow-image"]),
    shadowImageExpression: _optionalCastList(map["layout"]["shadow-image"]),
    topImage: _optionalCast(map["layout"]["top-image"]),
    topImageExpression: _optionalCastList(map["layout"]["top-image"]),
    accuracyRadius: _optionalCast(map["paint"]["accuracy-radius"]),
    accuracyRadiusExpression:
        _optionalCastList(map["paint"]["accuracy-radius"]),
    accuracyRadiusBorderColor:
        (map["paint"]["accuracy-radius-border-color"] as List?)?.toRGBAInt(),
    accuracyRadiusBorderColorExpression:
        _optionalCastList(map["paint"]["accuracy-radius-border-color"]),
    accuracyRadiusColor:
        (map["paint"]["accuracy-radius-color"] as List?)?.toRGBAInt(),
    accuracyRadiusColorExpression:
        _optionalCastList(map["paint"]["accuracy-radius-color"]),
    bearing: _optionalCast(map["paint"]["bearing"]),
    bearingExpression: _optionalCastList(map["paint"]["bearing"]),
    bearingImageSize: _optionalCast(map["paint"]["bearing-image-size"]),
    bearingImageSizeExpression:
        _optionalCastList(map["paint"]["bearing-image-size"]),
    emphasisCircleColor:
        (map["paint"]["emphasis-circle-color"] as List?)?.toRGBAInt(),
    emphasisCircleColorExpression:
        _optionalCastList(map["paint"]["emphasis-circle-color"]),
    emphasisCircleRadius:
        _optionalCast(map["paint"]["emphasis-circle-radius"]),
    emphasisCircleRadiusExpression:
        _optionalCastList(map["paint"]["emphasis-circle-radius"]),
    imagePitchDisplacement:
        _optionalCast(map["paint"]["image-pitch-displacement"]),
    imagePitchDisplacementExpression:
        _optionalCastList(map["paint"]["image-pitch-displacement"]),
    location: (map["paint"]["location"] as List?)
        ?.map<double?>((e) => e.toDouble())
        .toList(),
    locationExpression: _optionalCastList(map["paint"]["location"]),
    locationIndicatorOpacity:
        _optionalCast(map["paint"]["location-indicator-opacity"]),
    locationIndicatorOpacityExpression:
        _optionalCastList(map["paint"]["location-indicator-opacity"]),
    perspectiveCompensation:
        _optionalCast(map["paint"]["perspective-compensation"]),
    perspectiveCompensationExpression:
        _optionalCastList(map["paint"]["perspective-compensation"]),
    shadowImageSize: _optionalCast(map["paint"]["shadow-image-size"]),
    shadowImageSizeExpression:
        _optionalCastList(map["paint"]["shadow-image-size"]),
    topImageSize: _optionalCast(map["paint"]["top-image-size"]),
    topImageSizeExpression: _optionalCastList(map["paint"]["top-image-size"]),
  );
}