LineString.random constructor
LineString.random({
- int length = 2,
Creates a LineString with random Coordinates with the number of vertices specified length
.
The length
must be greater than 2, or an ArgumentError will be thrown.
Example:
LineString.random(); // LineString([Coordinate(?, ?), Coordinate(?, ?)])
Implementation
factory LineString.random({int length = 2}) {
if (length <= 2) {
throw ArgumentError('length must be greater than 2');
}
List<Coordinate> coordinates = [];
for (int i = 0; i < length; i++) {
coordinates.add(Coordinate.random());
}
return LineString(coordinates);
}