startForwarding method

Future<void> startForwarding()

Implementation

Future<void> startForwarding() async {
  try {
    // Check if stdin is a terminal before trying to set echo mode
    if (stdin.hasTerminal) {
      // Enable raw mode for single character input
      stdin.echoMode = false;
      stdin.lineMode = false;

      _inputSubscription = stdin.listen((List<int> data) {
        _handleInput(data);
      });

      if (verbose) {
        print('⌨️  Terminal input forwarding started');
        print('   All commands forwarded to Flutter except "r" (hot reload)');
      }
    } else {
      if (verbose) {
        print('⌨️  Terminal input forwarding skipped (not a terminal)');
      }
    }

  } catch (e) {
    if (verbose) {
      print('⚠️  Could not start terminal input forwarding: $e');
    }
    // Don't throw - this is not critical for hydration functionality
  }
}