DartSpawner class

Class capable to spawn a Dart script/File/Uri into an Isolate.

Inheritance

Constructors

DartSpawner({Directory? directory, DartProjectLogger? logger, bool logToConsole = false, Duration? startupTimeout})
Constructs a new DartSpawner.

Properties

exitCode Completer<int>
The exit code of the spawned Dart script/file.
final
hashCode int
The hash code for this object.
no setterinherited
id int
final
isFinished bool
Returns true if the spawned Dart script/file have finished.
no setter
isolateCheckPingTimeout Duration
The timeout of a Isolate check (calling Isolate.ping).
final
isSpawned bool
Returns true if this instance already have spawned a script.
no setter
projectDirectory FutureOr<Directory>
The resolved project Directory.
no setterinherited
projectLibraryName FutureOr<String?>
The resolved project library name.
no setterinherited
projectPackageConfigUri FutureOr<Uri>
The resolved project .dart_tool/package_config.json Uri.
no setterinherited
projectPackageName FutureOr<String?>
The resolved project package name.
no setterinherited
projectPubspec FutureOr<Map<String, dynamic>>
The resolved project pubspec.yaml Map.
no setterinherited
projectPubspecFile FutureOr<File>
The resolved project pubspec.yaml file.
no setterinherited
projectPubspecLock FutureOr<Map<String, dynamic>>
The resolved project pubspec.lock file as YamlMap.
no setterinherited
projectPubspecLockFile FutureOr<File>
The resolved project pubspec.lock File.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spawnedEntry Object?
The spawned Dart entry.
getter/setter pair
spawnedType String?
The spawned type.
getter/setter pair
startupTimeout Duration
The timeout to identify the Isolate startup.
final

Methods

cleanDartPubGetGeneratedFiles({required String confirmProjectName, bool verbose = false}) Future<bool>
Deletes files generated by dart pub get:
inherited
ensureProjectDependenciesResolved() Future<bool>
Ensures that projectDirectory has the dependencies resolved. If not resolved runs dart pub get, calling runDartPubGet.
inherited
executablePath(String executableName, {bool refresh = false}) Future<String?>
Returns an executable binary path for executableName.
inherited
existsProjectPackageConfigUri() FutureOr<bool>
Returns true if projectPackageConfigUri exists.
inherited
getProjectDependencyVersion(String package) FutureOr<String?>
Returns the version string of package at the target project dependencies.
inherited
isDartFilePath(dynamic dartEntryPoint) bool
Returns true if dartEntryPoint is a String and a File path with a '.dart' extension.
launchObservatory(String url) Future<ProcessResult>
Launches the observatory url.
log(String type, dynamic message) → void
Logs a message.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
projectSubDirectory(String filePath) FutureOr<Directory>
Returns a sub-Directory inside projectDirectory.
inherited
projectSubFile(String filePath) FutureOr<File>
Returns a sub-File inside projectDirectory.
inherited
projectSubUri(String filePath) FutureOr<Uri>
Returns a sub-Uri inside projectDirectory.
inherited
runDartPubGet() Future<bool>
Runs dart pub get in the projectDirectory.
inherited
runDartVM(String entrypoint, List<String> args, {bool enableVMService = false, String? vmServiceAddress, int? vmServicePort, bool pauseIsolatesOnStart = false, bool pauseIsolatesOnExit = false, bool pauseIsolatesOnUnhandledExceptions = false, String? workingDirectory, bool handleSignals = false, bool redirectOutput = false, bool catchOutput = false, String stdoutFilter(String o)?, String stderrFilter(String o)?, void onSignal(ProcessSignal signal)?}) Future<ProcessInfo>
Runs a new Dart VM.
inherited
runProcess(String commandName, List<String> args, {bool resolveCommandPath = true, String? workingDirectory, bool handleSignals = false, bool redirectOutput = false, bool catchOutput = false, String stdoutFilter(String o)?, String stderrFilter(String o)?, void onSignal(ProcessSignal signal)?}) Future<ProcessInfo>
Runs a Process command and returns it.
inherited
spawnDart(dynamic dartEntryPoint, List<String> args, {String? debugName, bool enableObservatory = false, bool runObservatory = false, bool usesSpawnedMain = false}) Future<SpawnedIsolate>
Spawn a Dart entry point (script, File or Uri).
spawnDartFile(File dartFile, List<String> args, {String? debugName, bool enableObservatory = false, bool runObservatory = false, bool usesSpawnedMain = false}) Future<SpawnedIsolate>
Spawn a Dart File.
spawnDartScript(String dartScript, List<String> args, {String? debugName, bool enableObservatory = false, bool runObservatory = false, bool usesSpawnedMain = false}) Future<SpawnedIsolate>
Spawn a Dart script.
spawnDartURI(Uri dartUri, List<String> args, {String? debugName, bool enableObservatory = false, bool runObservatory = false, bool usesSpawnedMain = false}) Future<SpawnedIsolate>
Spawn a Dart Uri.
supportsLaunchObservatory() Future<bool>
Returns true if this environment supports observatory launch.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

debugMode bool
If true sets the debug mode, to avoid Isolate issues while debugging.
final
defaultIsolateCheckPingTimeout Duration
The default Isolate check ping timeout.
final
defaultStartupTimeout Duration
The default startup timeout.
final
filePathReservedChars RegExp
final

Static Methods

logDebug(Object? m) → void