rangeTo method Null safety

IntRange rangeTo(
  1. int toInclusive,
  2. {int step = 1}
)

Creates a range from this value to the specified toInclusive value, inclusively.

Example:

1.rangeTo(3) // => 1, 2, 3
1.rangeTo(5, step: 2) // => 1, 3, 5

Implementation

IntRange rangeTo(int toInclusive, {int step = 1}) =>
    IntRange(this, toInclusive, step: step);