start method Null safety
Start a WSL distro by name @param distribution: String @param startPath: String (optional) Defaults to root ('/')
Implementation
void start(String distribution,
{String startPath = '',
String startUser = '',
String startCmd = ''}) async {
List<String> args = ['wsl', '-d', distribution];
if (startPath != '') {
args.addAll(['--cd', startPath]);
}
if (startUser != '') {
args.addAll(['--user', startUser]);
}
if (startCmd != '') {
for (String cmd in startCmd.split(' ')) {
args.add(cmd);
}
}
Process.start('start', args,
mode: ProcessStartMode.detached, runInShell: true);
}