getSpanForPosition method Null safety

InlineSpan? getSpanForPosition(
  1. TextPosition position
)

Returns the InlineSpan that contains the given position in the text.

Implementation

InlineSpan? getSpanForPosition(TextPosition position) {
  assert(debugAssertIsValid());
  final Accumulator offset = Accumulator();
  InlineSpan? result;
  visitChildren((InlineSpan span) {
    result = span.getSpanForPositionVisitor(position, offset);
    return result == null;
  });
  return result;
}