getLayer method
- String layerId
Returns a decoded Layer by id, or null when layerId is unknown or
its type is not handled.
Implementation
Future<Layer?> getLayer(String layerId) async {
final properties = await _impl.getStyleLayerProperties(layerId);
final map = json.decode(properties);
switch (map["type"]) {
case "background":
return BackgroundLayer.decode(properties);
case "location-indicator":
return LocationIndicatorLayer.decode(properties);
case "sky":
return SkyLayer.decode(properties);
case "circle":
return CircleLayer.decode(properties);
case "fill-extrusion":
return FillExtrusionLayer.decode(properties);
case "fill":
return FillLayer.decode(properties);
case "heatmap":
return HeatmapLayer.decode(properties);
case "hillshade":
return HillshadeLayer.decode(properties);
case "line":
return LineLayer.decode(properties);
case "raster":
return RasterLayer.decode(properties);
case "symbol":
return SymbolLayer.decode(properties);
case "model":
return ModelLayer.decode(properties);
case "slot":
return SlotLayer.decode(properties);
case "raster-particle":
return RasterParticleLayer.decode(properties);
case "clip":
return ClipLayer.decode(properties);
default:
return null;
}
}