Skip to main content
usage

Layers

UnifiedMap.children mixes two kinds of widgets.

Mobile layers​

The feature layers — TileLayer, MarkerLayer, PolylineLayer, PolygonLayer, CircleLayer, OverlayImageLayer, and the layers of extension packages — register their objects with the map through the platform. Each one is a MapLayerState: it receives an id, syncs its objects on every widget or camera change, and unregisters them on dispose. Object ids are stable (<layerId>/<key>), so the platform only receives the difference between generations. Each layer type has its own page in the layers section, and the order of children is the layers' z-order.

Static layers​

Any other child is not registered with the map: it is drawn above it in a Stack, in the list's order — compass buttons, attributions, search bars. It can follow the map through MapCamera.of(context) and the controller: that is how the demo builds overlays that track coordinates.

Hit testing and gestures​

  • Taps on markers are resolved natively and routed back (Marker.onTap); a tap on a marker with an onTap never reaches MapOptions.onTap.
  • Taps on polylines, polygons and circles are resolved in Dart through the layers' hit testers — pass a hitNotifier to the layer and read the hit values in MapOptions.onTap (see Polygon Layer).
  • onLongPress and onSecondaryTap (Android context click, iPadOS / macOS secondary click) complete the gesture set on every backend.