toList method

List<num> toList()

Generate all list of all values in the range.

Note that this method creates a new list each call. Consider maintaining a copy of the result in your own code rather than calling toList multiple times.

Why not cache the result in the object? The range could be quite large.

Implementation

List<num> toList() {
  final result = <num>[];

  for (var i in generate()) {
    result.add(i);
  }

  return result;
}