call method
Given a polygon (and its points), calculate a single position at which the center of the label should be placed
Polygon.points is not guaranteed to be non-empty. If empty, this may throw.
Implementation
@override
LatLng call(Polygon polygon) {
final (point: (:x, :y), distance: _) = dart_polylabel2.polylabel(
[
List<dart_polylabel2.Point>.generate(
polygon.points.length,
(i) =>
(x: polygon.points[i].latitude, y: polygon.points[i].longitude),
growable: false,
),
],
precision: precision,
);
return LatLng(x, y);
}