setStyleJson method

Future<CommandCompletion> setStyleJson(
  1. Object? json
)

Loads the map's style from json.

The command completes once the style has parsed, and the map's style is then loaded, as MapHandle.setStyleUrl() describes. The style's sources, sprites, and glyphs load in the background.

See mln_map_set_style_json in the C API reference.

Errors:

  • Status.nativeError when json isn't a valid style. The map keeps its current style.

Implementation

Future<CommandCompletion> setStyleJson(Object? json) => _command(
  (arena, completion) => raw.mln_map_set_style_json(
    _handle.raw,
    _nativeJsonView(json, arena),
    completion,
    nativeDiagnostic,
  ),
);