getRange method Null safety

Characters getRange(
  1. int start,
  2. [int? end]

Eagerly selects the range of characters from start to end.

The start value must be non-negative, and end, if supplied, must be greater than or equal to start.

A characters.getRange(start, end) is equivalent to

 (end != null ? characters.take(end) : characters).skip(start)

if end is omitted, the call is equivalent to characters.skip(start).

If start is greater than or equal to length the returned characters is empty. Otherwise, if end is greater than length, or omitted, end is equivalent to length.


Characters getRange(int start, [int? end]);