Polygon constructor

Polygon(
  1. Iterable<LatLng> nodes
)

Implementation

Polygon(Iterable<LatLng> nodes) : _nodes = List.of(nodes) {
  if (_nodes.isNotEmpty && _nodes.last == _nodes.first) _nodes.removeLast();
  if (_nodes.length < 3)
    throw GeometryException('A polygon must have at least three nodes.');
}