TextPosition constructor Null safety

const TextPosition(
  1. {required int offset,
  2. TextAffinity affinity = TextAffinity.downstream}
)

Creates an object representing a particular position in a string.

The arguments must not be null (so the offset argument is required).

Implementation

const TextPosition({
  required this.offset,
  this.affinity = TextAffinity.downstream,
}) : assert(offset != null),
     assert(affinity != null);