TextRange constructor Null safety

const TextRange(
  1. {required int start,
  2. required int end}
)

Creates a text range.

The start and end arguments must not be null. Both the start and end must either be greater than or equal to zero or both exactly -1.

The text included in the range includes the character at start, but not the one at end.

Instead of creating an empty text range, consider using the empty constant.

Implementation

const TextRange({
  required this.start,
  required this.end,
}) : assert(start != null && start >= -1),
      assert(end != null && end >= -1);