spawnDart method
Spawn a Dart entry point (script, File or Uri).
Implementation
Future<SpawnedIsolate> spawnDart(dynamic dartEntryPoint, List<String> args,
{String? debugName,
bool enableObservatory = false,
bool runObservatory = false,
bool usesSpawnedMain = false}) {
if (dartEntryPoint is File) {
return spawnDartFile(dartEntryPoint, args,
debugName: debugName,
enableObservatory: enableObservatory,
runObservatory: runObservatory,
usesSpawnedMain: usesSpawnedMain);
} else if (dartEntryPoint is Uri) {
return spawnDartURI(dartEntryPoint, args,
debugName: debugName,
enableObservatory: enableObservatory,
runObservatory: runObservatory,
usesSpawnedMain: usesSpawnedMain);
} else if (dartEntryPoint is String) {
if (isDartFilePath(dartEntryPoint)) {
var dartFile = File(dartEntryPoint);
return spawnDartFile(dartFile, args,
debugName: debugName,
enableObservatory: enableObservatory,
runObservatory: runObservatory,
usesSpawnedMain: usesSpawnedMain);
} else {
return spawnDartScript(dartEntryPoint, args,
debugName: debugName,
enableObservatory: enableObservatory,
runObservatory: runObservatory,
usesSpawnedMain: usesSpawnedMain);
}
} else {
throw StateError(
'Unsupported Dart entry point! type: ${dartEntryPoint.runtimeType} > $dartEntryPoint');
}
}