Focuses a particular widget, identified by its GlobalKey. The widget must be in the widget tree.
Don't call moveTo() 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 moveTo(GlobalKey key) { BuildContext focusedContext = key.currentContext; assert(focusedContext != null); _FocusScope focusScope = key.currentContext.ancestorWidgetOfExactType(_FocusScope); if (focusScope != null) { focusScope.focusState._setFocusedWidget(key); Scrollable.ensureVisible(focusedContext); } }