keyByPolygonId function

Map<PolygonId, Polygon> keyByPolygonId (
  1. Iterable<Polygon> polygons
)

Converts an Iterable of Polygons in a Map of PolygonId -> Polygon.

Implementation

Map<PolygonId, Polygon> keyByPolygonId(Iterable<Polygon> polygons) {
  if (polygons == null) {
    return <PolygonId, Polygon>{};
  }
  return Map<PolygonId, Polygon>.fromEntries(polygons.map((Polygon polygon) =>
      MapEntry<PolygonId, Polygon>(polygon.polygonId, polygon.clone())));
}