spawnDartScript method

Future<SpawnedIsolate> spawnDartScript(
  1. String dartScript,
  2. List<String> args, {
  3. String? debugName,
  4. bool enableObservatory = false,
  5. bool runObservatory = false,
  6. bool usesSpawnedMain = false,
})

Spawn a Dart script.

Implementation

Future<SpawnedIsolate> spawnDartScript(String dartScript, List<String> args,
    {String? debugName,
    bool enableObservatory = false,
    bool runObservatory = false,
    bool usesSpawnedMain = false}) {
  final dataUri = Uri.parse(
      'data:application/dart;charset=utf-8,${Uri.encodeComponent(dartScript)}');

  return _spawnDart(dartScript, '<script>', dataUri, args,
      debugName: debugName,
      enableObservatory: enableObservatory,
      runObservatory: runObservatory,
      usesSpawnedMain: usesSpawnedMain);
}