addStyleLayerJson method
Adds a layer to the map's style.
layerJson is a
[layer](https://maplibre.org/maplibre-style-spec/layers/) object. The
layer goes below the layer named beforeLayerId, or above every layer
when beforeLayerId is empty.
See mln_map_add_style_layer_json in the
C API reference.
Errors:
Status.notFoundwhen the style has no layer namedbeforeLayerId, or no source with the ID that the layer uses.Status.alreadyExistswhen the style already has a layer with the new layer's ID.Status.invalidStatewhile the style isn't loaded, asMapHandle.setStyleUrl()describes.
Implementation
Future<CommandCompletion> addStyleLayerJson(
Object? layerJson, {
String? beforeLayerId,
}) => _command(
(arena, completion) => raw.mln_map_add_style_layer_json(
_handle.raw,
_nativeJsonView(layerJson, arena),
beforeLayerId == null
? arena<raw.mln_buffer_view>().ref
: nativeStringView(beforeLayerId, arena).value,
completion,
nativeDiagnostic,
),
);