StyleLayer class abstract

A layer of a map style.

A layer is a plain object until it is on a map, either because it was added with StyleLayers.add or because it came from StyleController.layers. From then on it is its own controller: its setters also update the map, fire-and-forget and in order, so an animation can call them every frame. Removing the layer or loading a new style detaches the object, after which its setters only change the object.

Layers with vector features report taps and the mouse on their features to onClick, onEnter and onLeave while they are on a map.

Constructors

StyleLayer({required String id, double minZoom = 0, double maxZoom = 24, Expression<bool>? filter, bool visible = true, StyleLayerFeatureCallback? onClick, StyleLayerFeatureCallback? onEnter, StyleLayerFeatureCallback? onLeave})
Creates a layer that is not on a map yet.
StyleLayer.fromJson(Map<String, Object?> json)
Reads a layer from the JSON of a style layer. The class follows its type. This is the way to a layer with properties that this version of the package doesn't know yet; toJson writes them back.
factory

Properties

filter ↔ Expression<bool>?
The condition on source features. Only features that match it are shown. Zoom expressions in filters are only evaluated at integer zoom levels, and the feature-state expression is not supported in them.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
id → String
The unique name of the layer.
final
maxZoom ↔ double
The maximum zoom level of the layer. At and above it, the layer is hidden.
getter/setter pair
minZoom ↔ double
The minimum zoom level of the layer. Below it, the layer is hidden.
getter/setter pair
onClick ↔ StyleLayerFeatureCallback?
Called when the user taps or clicks a feature of this layer, with the topmost feature under the pointer.
getter/setter pair
onEnter ↔ StyleLayerFeatureCallback?
Called when a mouse or stylus moves onto a feature of this layer.
getter/setter pair
onLeave ↔ StyleLayerFeatureCallback?
Called when the mouse or stylus leaves the feature that onEnter reported, including when it leaves the map.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → String
The type of the layer in the style spec, such as line.
no setter
visible ↔ bool
Whether the layer is shown.
getter/setter pair

Methods

moveBelow(String? layerId) → void
Moves this layer below the layer layerId, or to the top if it is null. See StyleLayers.move.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The layer as the JSON of a style layer.
toString() → String
A string representation of this object.
inherited
updateFrom(StyleLayer other) → void
Sets every property of this layer that differs from other and leaves the rest alone. Only the changes reach the map.

Operators

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