getLeadingTextBoundaryAt method

int? getLeadingTextBoundaryAt(
  1. int position
)

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

int? getLeadingTextBoundaryAt(int position) {
  if (position < 0) {
    return null;
  }
  final int start = getTextBoundaryAt(position).start;
  return start >= 0 ? start : null;
}