StyleManager class

Manages the map's style, including layers, sources, images, and imports.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addGeoJSONSourceFeatures(String sourceId, String dataId, List<Feature<GeometryObject>> features) Future<void>
Adds features to a GeoJSON style source.
addLayer(Layer layer, [LayerPosition? position]) Future<void>
Adds a Layer to the current style. Serializes the layer to JSON and forwards to StylePlatformInterface.addStyleLayer.
addPersistentLayer(Layer layer, [LayerPosition? position]) Future<void>
Adds a persistent Layer to the current style. Persistent layers survive style reloads when the new style does not redefine the layer id.
addPersistentStyleLayer(String properties, LayerPosition? layerPosition) Future<void>
Adds a persistent style layer from a JSON properties string. Persistent layers survive style reloads when the new style does not redefine the same layer id. Prefer the typed addPersistentLayer helpers for facade layer classes.
addSource(Source source) Future<void>
Adds a Source to the current style. Sources with multi-phase add requirements (e.g. GeoJsonSource with initial data) override Source.addToStyle to handle their specifics.
addStyleImage(String imageId, double scale, MbxImage image, {bool sdf = false, List<ImageStretches?> stretchX = const <ImageStretches?>[], List<ImageStretches?> stretchY = const <ImageStretches?>[], ImageContent? content}) Future<void>
Adds an image to the style. Existing images with the same imageId are replaced. stretchX and stretchY default to empty lists; content and sdf to null/false — mirroring the most common usage.
addStyleImportFromJSON(String importId, String json, {Map<String, Object>? config, ImportPosition? importPosition}) Future<void>
Adds a new import to the current style from a JSON string.
addStyleImportFromURI(String importId, String uri, {Map<String, Object>? config, ImportPosition? importPosition}) Future<void>
Adds a new import to the current style from a URI.
addStyleLayer(String properties, LayerPosition? layerPosition) Future<void>
Adds a new style layer from a JSON properties string. Prefer the typed addLayer / addLayerAt helpers when constructing layers from facade classes; this raw-JSON form is for callers driving layers from style spec strings directly.
addStyleModel(String modelId, String modelUri) Future<void>
Adds a 3D model to the style for use as model-id in a model layer.
addStyleSource(String sourceId, String properties) Future<void>
Adds a new style source from a JSON properties string. Prefer the typed addSource helper when constructing sources from facade classes; this raw-JSON form is for callers driving sources from style spec strings.
getFeaturesets() Future<List<FeaturesetDescriptor>>
Returns the featuresets defined by the currently loaded style.
getLayer(String layerId) Future<Layer?>
Returns a decoded Layer by id, or null when layerId is unknown or its type is not handled.
getProjection() Future<StyleProjection?>
Returns the style projection.
getSource(String sourceId) Future<Source?>
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.
getStyleDefaultCamera() Future<CameraOptions>
Returns the default camera position defined by the style.
getStyleImage(String imageId) Future<MbxImage?>
Returns a previously-added style image, or null when imageId is unknown.
getStyleImportConfigProperties(String importId) Future<Map<String, StylePropertyValue>>
Returns all configuration properties for a style import as a map.
getStyleImportConfigProperty(String importId, String config) Future<StylePropertyValue>
Returns a single configuration property for a style import.
getStyleImports() Future<List<StyleObjectInfo?>>
Returns all current style imports.
getStyleImportSchema(String importId) Future<Object>
Returns the schema of a style import.
getStyleJSON() Future<String>
Returns the current style as a JSON string.
getStyleLayerProperties(String layerId) Future<String>
Returns all properties of a layer as a JSON string.
getStyleLayerProperty(String layerId, String property) Future<StylePropertyValue>
Returns the live value of a single layer property.
getStyleLayers() Future<List<StyleObjectInfo?>>
Returns all style layers.
getStyleLightProperty(String id, String property) Future<StylePropertyValue>
Returns the live value of a single light property.
getStyleLights() Future<List<StyleObjectInfo?>>
Returns the current style's lights.
getStyleSourceProperties(String sourceId) Future<String>
Returns all properties of a source as a JSON string.
getStyleSourceProperty(String sourceId, String property) Future<StylePropertyValue>
Returns the live value of a single source property as a StylePropertyValue envelope.
getStyleSources() Future<List<StyleObjectInfo?>>
Returns all style sources.
getStyleTerrainProperty(String property) Future<StylePropertyValue>
Returns the live value of a single terrain property.
getStyleTransition() Future<TransitionOptions>
Returns the current style transition options.
getStyleURI() Future<String>
Returns the current style URI.
hasStyleImage(String imageId) Future<bool>
Returns whether an image with the given id exists.
invalidateStyleCustomGeometrySourceRegion(String sourceId, CoordinateBounds bounds) Future<void>
Invalidates a region in a custom geometry source so its tiles get re-fetched.
invalidateStyleCustomGeometrySourceTile(String sourceId, CanonicalTileID tileId) Future<void>
Invalidates a tile in a custom geometry source so it gets re-fetched.
isStyleLayerPersistent(String layerId) Future<bool>
Returns whether the layer with the given id is persistent.
isStyleLoaded() Future<bool>
Returns whether the style is fully loaded.
localizeLabels(String locale, List<String>? layerIds) Future<void>
Localizes label text in the style for the given locale, optionally scoped to a subset of layers.
moveStyleImport(String importId, ImportPosition? importPosition) Future<void>
Moves an import to a new position.
moveStyleLayer(String layerId, LayerPosition? layerPosition) Future<void>
Moves a style layer to a new position.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeGeoJSONSourceFeatures(String sourceId, String dataId, List<String> featureIds) Future<void>
Removes features from a GeoJSON style source by id.
removeStyleImage(String imageId) Future<void>
Removes a style image.
removeStyleImport(String importId) Future<void>
Removes an import from the style.
removeStyleLayer(String layerId) Future<void>
Removes a style layer.
removeStyleModel(String modelId) Future<void>
Removes a 3D model from the style.
removeStyleSource(String sourceId) Future<void>
Removes a style source.
setLight(FlatLight flatLight) Future<void>
Sets a single flat light source. Use setLights for ambient + directional.
setLights(AmbientLight ambientLight, DirectionalLight directionalLight) Future<void>
Sets ambient + directional lights together. Disables any flat light.
setProjection(StyleProjection projection) Future<void>
Sets the style projection.
setStyleImportConfigProperties(String importId, Map<String, Object> configs) Future<void>
Sets all configuration properties for an import from a map.
setStyleImportConfigProperty(String importId, String config, Object value) Future<void>
Sets an import configuration property value.
setStyleJSON(String json) Future<void>
Loads a style from a JSON string.
setStyleLayerProperties(String layerId, String properties) Future<void>
Sets all properties of a layer from a JSON object string.
setStyleLayerProperty(String layerId, String property, Object value) Future<void>
Sets a layer property value from a JSON string.
setStyleLightProperty(String id, String property, Object value) Future<void>
Sets a value on a single light property.
setStyleSourceProperties(String sourceId, String properties) Future<void>
Sets all properties of a source from a JSON object string.
setStyleSourceProperty(String sourceId, String property, Object value) Future<void>
Sets a source property value from a JSON string.
setStyleTerrain(String properties) Future<void>
Sets the style terrain from a JSON string.
setStyleTerrainProperty(String property, Object value) Future<void>
Sets a value on a single terrain property.
setStyleTransition(TransitionOptions transitionOptions) Future<void>
Sets the style transition options.
setStyleURI(String uri) Future<void>
Loads a style from a URI.
styleLayerExists(String layerId) Future<bool>
Returns whether a layer with the given id exists.
styleSourceExists(String sourceId) Future<bool>
Returns whether a source with the given id exists.
toString() String
A string representation of this object.
inherited
updateGeoJSONSourceFeatures(String sourceId, String dataId, List<Feature<GeometryObject>> features) Future<void>
Updates existing features in a GeoJSON style source.
updateLayer(Layer layer) Future<void>
Updates an existing layer. Serializes the layer to JSON and forwards to StylePlatformInterface.setStyleLayerProperties.
updateSource(Source source) Future<void>
Updates an existing source. Serializes the source to JSON and forwards to StylePlatformInterface.setStyleSourceProperties.
updateStyleImageSourceImage(String sourceId, MbxImage image) Future<void>
Replaces the image data of an existing image-type style source.
updateStyleImportWithJSON(String importId, String json, {Map<String, Object>? config}) Future<void>
Updates an existing import from a JSON string.
updateStyleImportWithURI(String importId, String uri, {Map<String, Object>? config}) Future<void>
Updates an existing import from a URI.

Operators

operator ==(Object other) bool
The equality operator.
inherited