base property

TextPosition get base

The position at which the selection originates.

The TextAffinity of the resulting TextPosition is based on the relative logical position in the text to the other selection endpoint:

Might be larger than, smaller than, or equal to extent.

Implementation

TextPosition get base {
  final TextAffinity affinity;
  if (!isValid || baseOffset == extentOffset) {
    affinity = this.affinity;
  } else if (baseOffset < extentOffset) {
    affinity = TextAffinity.downstream;
  } else {
    affinity = TextAffinity.upstream;
  }
  return TextPosition(offset: baseOffset, affinity: affinity);
}