dispose method
Cancels the input subscription and releases resources.
Must be called when the program is done reading terminal input; otherwise the live input subscription keeps the process from exiting.
Implementation
@override
Future<void> dispose() async {
final subscription = _inputSubscription;
final controller = _inputController;
_inputSubscription = null;
_inputController = null;
await subscription?.cancel();
if (controller != null && !controller.isClosed) {
await controller.close();
}
}