AnnotationManager<T extends Annotation> class
abstract
Manages a homogeneous set of Annotations (e.g. symbols, lines, fills) by owning their backing style source(s)/layer(s) and performing efficient batched updates.
The initialize method must be called before AnnotationManager instance can be used. Once AnnotationManager is initialized, the isInitialized getter will return true.
An AnnotationManager keeps an internal mapping from annotation id to its model object and mirrors the collection into one or more GeoJSON sources; each source is bound to a style layer whose visual properties come from allLayerProperties.
When enableInteraction is true, drag events are listened to and the underlying annotation is translated & re-set.
Constructors
- AnnotationManager(MapLibreMapController controller, {int selectLayer(T)?, required bool enableInteraction})
Properties
-
allLayerProperties
→ List<
LayerProperties> -
Layer property definitions (one per backing style layer). Override in
subclasses to specify visual styling for data-driven attributes.
no setter
-
annotations
→ Set<
T> -
Current set of managed annotations.
no setter
- controller → MapLibreMapController
-
final
- enableInteraction → bool
-
If false, the manager disables user interaction (e.g. dragging) for
its annotations.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Base identifier of the manager. Use layerIds for concrete layer ids.
final
- isInitialized → bool
-
Tracks whether the manager and its layers were initialized.
no setter
-
layerIds
→ List<
String> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectLayer → int Function(T)?
-
Optional function used to select which layer/source a given annotation
should live in (e.g. pattern vs non-pattern lines). If null, a single
layer/source is used.
final
Methods
-
add(
T annotation) → Future< void> - Adds a single annotation.
-
addAll(
Iterable< T> annotations) → Future<void> - Adds multiple annotations (faster than adding one-by-one).
-
byId(
String id) → T? -
Returns the annotation with the given
id, or null if not found. -
clear(
) → Future< void> - Removes all annotations.
-
dispose(
) → Future< void> - Fully dispose resources (layers & sources). Manager is unusable after.
-
initialize(
) → Future< void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
T annotation) → Future< void> - Removes a single annotation.
-
removeAll(
Iterable< T> annotations) → Future<void> - Removes multiple annotations.
-
set(
T annotation) → Future< void> - Updates (re-sets) an existing annotation quickly by only replacing its underlying GeoJSON feature if it remains on the same logical layer.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited