addStyleSourceJson method

Future<CommandCompletion> addStyleSourceJson(
  1. String sourceId,
  2. Object? sourceJson
)

Adds a source to the map's style.

sourceJson is a [source](https://maplibre.org/maplibre-style-spec/sources/) object.

See mln_map_add_style_source_json in the C API reference.

Errors:

  • Status.alreadyExists when the style already has a source named sourceId.
  • Status.invalidState while the style isn't loaded, as MapHandle.setStyleUrl() describes.

Implementation

Future<CommandCompletion> addStyleSourceJson(
  String sourceId,
  Object? sourceJson,
) => _command(
  (arena, completion) => raw.mln_map_add_style_source_json(
    _handle.raw,
    nativeStringView(sourceId, arena).value,
    _nativeJsonView(sourceJson, arena),
    completion,
    nativeDiagnostic,
  ),
);