FocusManager constructor

FocusManager()

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.

Implementation

FocusManager() {
  if (kFlutterMemoryAllocationsEnabled) {
    ChangeNotifier.maybeDispatchObjectCreation(this);
  }
  if (_respondToWindowFocus) {
    _appLifecycleListener = _AppLifecycleListener(_appLifecycleChange);
    WidgetsBinding.instance.addObserver(_appLifecycleListener!);
  }
  rootScope._manager = this;
}