reverse method
Returns a LineString that is a copy of the LineString with the coordinates reversed. The first coordinate will become the last, and the last coordinate will become the first. If the LineString is a closed ring, the first and last coordinate will be the same.
Example:
LineString([Coordinate(1, 2), Coordinate(3, 4), Coordinate(1, 4), Coordinate(1, 2)]).reverse(); // LineString([Coordinate(1, 2), Coordinate(1, 4), Coordinate(3, 4), Coordinate(1, 2)])
LineString([Coordinate(1, 2), Coordinate(3, 4), Coordinate(1, 4)]).reverse(); // LineString([Coordinate(1, 4), Coordinate(3, 4), Coordinate(1, 2)])
Implementation
LineString reverse() {
return LineString(coordinates.reversed.toList(), properties: properties);
}