removeNode method

void removeNode(
  1. FocusNode node
)

Removes node from this scope and transfers focus if needed.

Implementation

void removeNode(FocusNode node) {
  final index = _nodes.indexOf(node);
  if (index != -1) {
    node._setFocus(false);
    _nodes.removeAt(index);
    node._scope = null;

    if (index <= _currentIndex && _nodes.isNotEmpty) {
      _currentIndex = _currentIndex.clamp(0, _nodes.length - 1);
      if (_isActive) {
        _nodes[_currentIndex]._setFocus(true);
      }
    }
  }
}