startWithStdin static method
Starts a Flutter process with stdin forwarding for interactive commands.
This method is specifically designed for interactive Flutter commands that require user input (like Flutter run with hot reload support). It forwards stdin from the parent process to the Flutter process, allowing for interactive development workflows.
Parameters:
argument: The Flutter command argumentsshowLog: Whether to show the command being executedsingleCharacterMode: Whether to enable single character input mode (for hot keys)workingDirectory: The working directory for the processprogressOut: Callback for stdout linesprogressErr: Callback for stderr lines
Example:
// Start Flutter app with hot reload support
await FlutterHelper.startWithStdin('run');
// Start Flutter app with single character mode for hot keys
await FlutterHelper.startWithStdin('run', singleCharacterMode: true);
Note: This method should only be used for interactive commands that require user input. For non-interactive commands, use run or start instead.
Implementation
static Future<int> startWithStdin(
String argument, {
bool showLog = false,
bool singleCharacterMode = false,
String? workingDirectory,
void Function(String line)? progressOut,
void Function(String line)? progressErr,
}) {
String command = '${getCommandFlutter()} $argument';
if (showLog) printMessage(command);
return command.startWithStdin(
workingDirectory: workingDirectory,
progressOut: progressOut,
progressErr: progressErr,
singleCharacterMode: singleCharacterMode,
);
}