void moveScopeTo(GlobalKey key, { BuildContext context })

Focuses a particular focus scope, identified by its GlobalKey.

Don't call moveScopeTo() from your build() functions, it's intended to be called from event listeners, e.g. in response to a finger tap or tab key.

Source

static void moveScopeTo(GlobalKey key, { BuildContext context }) {
  _FocusScope focusScope;
  BuildContext searchContext = key.currentContext;
  if (searchContext != null) {
    assert(key.currentWidget is Focus);
    focusScope = searchContext.ancestorWidgetOfExactType(_FocusScope);
    assert(context == null || focusScope == context.ancestorWidgetOfExactType(_FocusScope));
  } else {
    focusScope = context.ancestorWidgetOfExactType(_FocusScope);
  }
  if (focusScope != null)
    focusScope.focusState._setFocusedScope(key);
}