lines property
Gets a list of line segments formed by connecting consecutive points. Each line segment is represented as a list of two LatLng points.
Implementation
List<List<LatLng>> get lines {
final lines = <List<LatLng>>[];
// Iterate through each point and connect it to the next point in the list.
for (var i = 0; i < points.length; i++) {
// Calculate the index of the next point, wrapping around if necessary.
final nextIndex = (i + 1) % points.length;
// Add the current point and next point to a new line segment.
lines.add([points[i], points[nextIndex]]);
}
return lines;
}