initialize method

void initialize()

Initializes the focus manager and starts listening to keyboard events.

Implementation

void initialize() {
  _keySubscription?.cancel();
  Stream<KeyEvent> stream;
  if (_testKeyEvents != null) {
    stream = _testKeyEvents!;
  } else {
    stream = WidgetsBinding.instance.keyboard.keyEvents;
  }
  _keySubscription = stream.listen(_handleKeyEvent);
}