keyByCircleId function

Map<CircleId, Circle> keyByCircleId (
  1. Iterable<Circle> circles
)

Converts an Iterable of Circles in a Map of CircleId -> Circle.

Implementation

Map<CircleId, Circle> keyByCircleId(Iterable<Circle> circles) {
  if (circles == null) {
    return <CircleId, Circle>{};
  }
  return Map<CircleId, Circle>.fromEntries(circles.map((Circle circle) =>
      MapEntry<CircleId, Circle>(circle.circleId, circle.clone())));
}