containsPosition method

  1. @override
bool containsPosition(
  1. Object position
)
override

Returns true if this DocumentNode contains the given position, or false if the position doesn't sit within this node, or if the position type doesn't apply to this DocumentNode.

Implementation

@override
bool containsPosition(Object position) {
  if (position is! TextNodePosition) {
    return false;
  }

  if (position.offset < 0 || position.offset > text.length) {
    return false;
  }

  return true;
}