getWordBoundary method Null safety

TextRange getWordBoundary(
  1. TextPosition position

Returns the TextRange of the word at the given TextPosition.

Characters not part of a word, such as spaces, symbols, and punctuation, have word breaks on both sides. In such cases, this method will return offset, offset+1. Word boundaries are defined more precisely in Unicode Standard Annex #29


TextRange getWordBoundary(TextPosition position) {
  final List<int> boundary = _getWordBoundary(position.offset);
  return TextRange(start: boundary[0], end: boundary[1]);