getTrailingTextBoundaryAt method
- int position
override
Returns the offset of the closest text boundary after the given
position
, or null if there is no boundary can be found after position
.
The return value, if not null, is usually greater than position
.
The range of the return value is given by the closed interval
[0, string.length]
.
Implementation
@override
int? getTrailingTextBoundaryAt(int position) {
if (position >= _text.length) {
return null;
}
final CharacterRange rangeAtPosition = CharacterRange.at(_text, max(0, position + 1));
final int nextBoundary = rangeAtPosition.stringBeforeLength + rangeAtPosition.current.length;
assert(nextBoundary == _text.length || CharacterRange.at(_text, nextBoundary).isEmpty);
return nextBoundary;
}