start static method
Future<SidecarClient>
start({
- required String executablePath,
- required String token,
- void onLog(
- String line
- SidecarProcessStarter? processStarter,
- SidecarRestartPolicy restartPolicy = const SidecarRestartPolicy(),
- int streamWindow = 16,
Implementation
static Future<SidecarClient> start({
required String executablePath,
required String token,
void Function(String line)? onLog,
SidecarProcessStarter? processStarter,
SidecarRestartPolicy restartPolicy = const SidecarRestartPolicy(),
int streamWindow = 16,
}) async {
restartPolicy._validate();
if (streamWindow < 1 || streamWindow > 256) {
throw ArgumentError.value(
streamWindow,
'streamWindow',
'Use a value between 1 and 256.',
);
}
final starter = processStarter ?? _startSystemProcess;
final process = await starter(executablePath, ['--token', token]);
return SidecarClient._(
process: process,
executablePath: executablePath,
token: token,
processStarter: starter,
restartPolicy: restartPolicy,
streamWindow: streamWindow,
onLog: onLog,
);
}