MapLayerState<W extends StatefulWidget> class
abstract
Base state of every map layer, built-in or from another package.
It owns a layerId, follows the map (host) it is placed under, and calls sync whenever the widget or the
map changes; the layer then registers its objects with host.registry (directly, through a MarkerPublisher,
setPolylines or setFlutterMapLayers). Everything the layer registered is removed when it is disposed or moves
to another map. The widget must be placed (directly or inside other widgets) in UnifiedMap.children, whose
order is the layers' z-order; build returns an empty box, override it to draw Flutter widgets above the map.
Constructors
Properties
- context → BuildContext
-
The location in the tree where this widget builds.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- host → MapLayerHost
-
The map this layer lives in. Available from the first sync on.
no setter
- layerId → String
-
Unique per layer; prefix of every object id of this layer.
final
- mounted → bool
-
Whether this State object is currently in a tree.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- widget → W
-
The current configuration.
no setterinherited
Methods
-
activate(
) → void -
Called when this object is reinserted into the tree after having been
removed via deactivate.
inherited
-
attachHost(
MapLayerHost host) → void -
Called before the first sync on a map: subscribe to
host.idleCamera/host.liveCamerahere. -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
deactivate(
) → void -
Called when this object is removed from the tree.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
detachHost(
MapLayerHost host) → void -
Called when the layer leaves
host(disposed or moved to another map): unsubscribe here. -
didChangeDependencies(
) → void -
Called when a dependency of this State object changes.
override
-
didUpdateWidget(
covariant W oldWidget) → void -
Called whenever the widget configuration changes.
override
-
dispose(
) → void -
Called when this object is removed from the tree permanently.
override
-
initState(
) → void -
Called when this object is inserted into the tree.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
objectId(
Key? key, int index) → String -
Object id for the element at
index, or for itskeywhen it has one. Ids of a layer start with'<layerId>/'so that taps come back to it. -
reassemble(
) → void -
Called whenever the application is reassembled during debugging, for
example during hot reload.
inherited
-
setFlutterMapLayers(
List< Widget> layers) → void -
Replaces the flutter_map layer widgets this layer draws inside the map when
host.supportsFlutterMapLayers; ignored on native maps. -
setPolylines(
List< Polyline< polylines) → voidObject> > -
Replaces the layer's polylines (ids
'<layerId>/<index>', painted in list order) right away. Pass them toMarkerPublisher.publishinstead when they belong with a generation of markers (spiderfy legs), so that they reach the map together. -
setState(
VoidCallback fn) → void -
Notify the framework that the internal state of this object has changed.
inherited
-
sync(
) → void - Registers the layer's current objects with host. Called after the layer is attached to a map, when the widget is updated (unless updateShouldSync says otherwise), when an inherited dependency changes (the map's pixel ratio or theme among them) and when the layer's z-index changes.
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
-
updateShouldSync(
covariant W oldWidget) → bool -
Whether an update from
oldWidgetneeds a sync. Override it to skip rebuilding objects that did not change.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited