InputManager constructor

InputManager({
  1. required InputDispatcher dispatcher,
})

Creates an InputManager forwarding parsed events to the given dispatcher.

Automatically configures terminal modes, enables mouse input, and begins listening for stdin input bytes.

Implementation

InputManager({required InputDispatcher dispatcher})
  : _dispatcher = dispatcher {
  _configureStdin();
  _enableMouseInput();

  ProcessSignal.sigint.watch().listen((signal) {
    // Gracefully handle Ctrl-C (SIGINT)
    _manageHandlers([0x03]);
  });

  if (Platform.isWindows) {
    _enableWindowsAnsi();
  }

  _stdinSubscription = stdin.listen(_manageHandlers);
}