toCoordinateArrayWithCheck method

List<Coordinate> toCoordinateArrayWithCheck(
  1. bool isForward
)

Creates an array containing the coordinates in this list, oriented in the given direction (forward or reverse).

@param direction the direction value: true for forward, false for reverse @return an oriented array of coordinates

Implementation

List<Coordinate> toCoordinateArrayWithCheck(bool isForward) {
  if (isForward) {
    return _backingList;
  }
  // construct reversed array
  List<Coordinate> pts = [];
  _backingList.reversed.forEach((element) {
    pts.add(element);
  });
  return pts;
}