keyByPolylineId function

Map<PolylineId, Polyline> keyByPolylineId (
  1. Iterable<Polyline> polylines
)

Converts an Iterable of Polylines in a Map of PolylineId -> Polyline.

Implementation

Map<PolylineId, Polyline> keyByPolylineId(Iterable<Polyline> polylines) {
  if (polylines == null) {
    return <PolylineId, Polyline>{};
  }
  return Map<PolylineId, Polyline>.fromEntries(polylines.map(
      (Polyline polyline) => MapEntry<PolylineId, Polyline>(
          polyline.polylineId, polyline.clone())));
}