setMarkers method

void setMarkers(
  1. String layerId,
  2. List<PlatformMarker> markers, {
  3. MarkerTapHandler? onTap,
  4. MarkerTransition? transition,
})

Replaces the markers of layerId. transition animates this layer's markers in the next marker push (the other layers' markers are not animated); transitions set before that push are merged, and only the entries of markers that the push really adds or removes are sent.

Implementation

void setMarkers(
  String layerId,
  List<PlatformMarker> markers, {
  MarkerTapHandler? onTap,
  MarkerTransition? transition,
}) {
  _markers[layerId] = markers;
  if (onTap == null) {
    _markerTaps.remove(layerId);
  } else {
    _markerTaps[layerId] = onTap;
  }
  if (transition != null) {
    final pending = _markerTransitions[layerId];
    _markerTransitions[layerId] = pending == null ? transition : pending.merge(transition);
  }
  _mark(MapObjectKind.markers);
}