dart_spawner 1.1.0
dart_spawner: ^1.1.0 copied to clipboard
Runs a Dart script/File/Uri inside a new Isolate of the current Dart VM. It also can spawn a Dart File from another Dart project/package into the current Dart VM.
example/dart_spawner_example.dart
import 'package:dart_spawner/dart_spawner.dart';
void main() async {
var spawner = DartSpawner(logToConsole: true);
var script = r'''
void main(List<String> args) {
print('From Script! Args: $args');
}
''';
print('Spawning Script: <<<\n\n$script\n>>>');
var spawned = await spawner.spawnDart(script, ['a', 'b', 'c']);
print('Spawned: $spawned');
var exitCode = await spawned.exitCode;
print('Exit code: $exitCode');
}