area property
override
Area of this polygon using the shoelace formula.
Always returns a positive value.
Implementation
@override
double get area {
double x = 0, y = 0;
final n = vertices.length;
for (var i = 0; i < n; i++) {
final nextI = (i + 1) % n;
x += vertices[i].x * vertices[nextI].y;
y += vertices[i].y * vertices[nextI].x;
}
return ((x - y) / 2).abs();
}