FocusManager constructor


Creates an object that manages the focus tree.

This constructor is rarely called directly. To access the FocusManager, consider using the FocusManager.instance accessor instead (which gets it from the WidgetsBinding singleton).

This newly constructed focus manager does not have the necessary event handlers registered to allow it to manage focus. To register those event handlers, callers must call registerGlobalHandlers. See the documentation in that method for caveats to watch out for.


FocusManager() {
  if (kFlutterMemoryAllocationsEnabled) {
  if (kIsWeb || defaultTargetPlatform != {
    // It appears that some Android keyboard implementations can cause
    // app lifecycle state changes: adding this listener would cause the
    // text field to unfocus as the user is trying to type.
    // Until this is resolved, we won't be adding the listener to Android apps.
    _appLifecycleListener = _AppLifecycleListener(_appLifecycleChange);
  rootScope._manager = this;