setFirstFocus method

void setFirstFocus (FocusScopeNode scope)

Make the given scope the active child scope for this scope.

If the given scope is not yet a part of the focus tree, then add it to the tree as a child of this scope. If it is already part of the focus tree, the given scope must be a descendant of this scope.

Implementation

void setFirstFocus(FocusScopeNode scope) {
  assert(scope != null);
  if (scope._parent == null) {
    _reparent(scope);
  }
  assert(scope.ancestors.contains(this), '$FocusScopeNode $scope must be a child of $this to set it as first focus.');
  if (hasFocus) {
    scope._doRequestFocus();
  } else {
    scope._setAsFocusedChild();
  }
}