getSource method
- String sourceId
Returns a Source by id, or null when sourceId is unknown or its
type is not handled. The returned source is bound to this style so
subsequent property getters work.
Implementation
Future<Source?> getSource(String sourceId) async {
final properties = await _impl.getStyleSourceProperties(sourceId);
final map = json.decode(properties);
Source? source;
switch (map["type"]) {
case "vector":
source = VectorSource(id: sourceId);
break;
case "geojson":
source = GeoJsonSource(id: sourceId);
break;
case "image":
source = ImageSource(id: sourceId);
break;
case "raster-dem":
source = RasterDemSource(id: sourceId);
break;
case "raster":
source = RasterSource(id: sourceId);
break;
case "raster-array":
source = RasterArraySource(id: sourceId);
break;
}
source?.bind(_impl);
return source;
}