createOrStart method
Start an existing simulator or create a new one
showAfterStart
- when false
, the simulator is booted in the background
and not rendered by the GUI. Defaults true
.
Implementation
@override
Future<void> createOrStart({bool showAfterStart = true}) async {
if (uuid != null) {
await runWithError('xcrun', ['simctl', 'boot', uuid!]);
return;
}
final devices = await availableDevices();
final device = firstWhereOrNull<IosSimulator>(
devices,
(d) => d.os == os && d.osVersion == osVersion && d.status == 'Shutdown' && d.model == model,
);
if (device != null) {
uuid = device.uuid;
await device.start();
} else {
await create();
await start();
}
if (showAfterStart) {
await runWithError('open', ['-a', 'Simulator', '--args', uuid!]);
}
}