base property
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:
- if baseOffset < extentOffset, base will have TextAffinity.downstream and extent will have TextAffinity.upstream.
- if baseOffset > extentOffset, base will have TextAffinity.upstream and extent will have TextAffinity.downstream.
- if baseOffset == extentOffset, base and extent will both have the collapsed selection's affinity.
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);
}