autofocus method

void autofocus (FocusNode node)

If this scope lacks a focus, request that the given node becomes the focus.

Useful for widgets that wish to grab the focus if no other widget already has the focus.

The node is notified that it has received the overall focus in a microtask.

Implementation

void autofocus(FocusNode node) {
  assert(node != null);
  if (_focus == null) {
    node._hasKeyboardToken = true;
    _setFocus(node);
  }
}