addGeoJsonSource method
- String sourceId, {
- GeoJsonSourceOptions? options,
- String? attribution,
Adds a GeoJSON source with no data.
Give it data with MapHandle.setGeoJsonSourceData() or
MapHandle.setGeoJsonSourceUrl(). Its options stay fixed for as long as
the style holds it.
attribution is the source's
[attribution](https://maplibre.org/maplibre-style-spec/sources/#attribution),
or empty for none.
See mln_map_add_geo_json_source in the
C API reference.
Errors:
Status.invalidArgumentwhen an option inoptionsis out of range.Status.alreadyExistswhen the style already has a source namedsourceId.Status.invalidStatewhile the style isn't loaded, asMapHandle.setStyleUrl()describes.
Implementation
Future<CommandCompletion> addGeoJsonSource(
String sourceId, {
GeoJsonSourceOptions? options,
String? attribution,
}) => _command(
(arena, completion) => raw.mln_map_add_geo_json_source(
_handle.raw,
nativeStringView(sourceId, arena).value,
options == null ? nullptr : _writeGeoJsonSourceOptions(options, arena),
attribution == null
? arena<raw.mln_buffer_view>().ref
: nativeStringView(attribution, arena).value,
completion,
nativeDiagnostic,
),
);