getOffsetAfter method

int? getOffsetAfter(
  1. int offset
)

Returns the closest offset after offset at which the input cursor can be positioned.

Implementation

int? getOffsetAfter(int offset) {
  final int? nextCodeUnit = _text!.codeUnitAt(offset);
  if (nextCodeUnit == null) {
    return null;
  }
  // TODO(goderbauer): doesn't handle extended grapheme clusters with more than one Unicode scalar value (https://github.com/flutter/flutter/issues/13404).
  return isHighSurrogate(nextCodeUnit) ? offset + 2 : offset + 1;
}