TextSelection constructor Null safety

const TextSelection(
  1. {required int baseOffset,
  2. required int extentOffset,
  3. TextAffinity affinity = TextAffinity.downstream,
  4. bool isDirectional = false}
)

Creates a text selection.

The baseOffset and extentOffset arguments must not be null.

Implementation

const TextSelection({
  required this.baseOffset,
  required this.extentOffset,
  this.affinity = TextAffinity.downstream,
  this.isDirectional = false,
}) : super(
       start: baseOffset < extentOffset ? baseOffset : extentOffset,
       end: baseOffset < extentOffset ? extentOffset : baseOffset,
     );