getLeadingTextBoundaryAt method
- int position
override
Returns the offset of the closest text boundary before or at the given
position
, or null if no boundaries can be found.
The return value, if not null, is usually less than or equal to position
.
The range of the return value is given by the closed interval
[0, string.length]
.
Implementation
@override
int? getLeadingTextBoundaryAt(int position) {
if (position < 0) {
return null;
}
final int graphemeStart = CharacterRange.at(_text, min(position, _text.length)).stringBeforeLength;
assert(CharacterRange.at(_text, graphemeStart).isEmpty);
return graphemeStart;
}