keyByMarkerId function

Map<MarkerId, Marker> keyByMarkerId (
  1. Iterable<Marker> markers
)

Converts an Iterable of Markers in a Map of MarkerId -> Marker.

Implementation

Map<MarkerId, Marker> keyByMarkerId(Iterable<Marker> markers) {
  if (markers == null) {
    return <MarkerId, Marker>{};
  }
  return Map<MarkerId, Marker>.fromEntries(markers.map((Marker marker) =>
      MapEntry<MarkerId, Marker>(marker.markerId, marker.clone())));
}