DartProject class

Class to resolve a Dart project directory.

Constructors

DartProject({Directory? directory, DartProjectLogger? logger, bool logToConsole = false})

Properties

hashCode int
The hash code for this object.
no setterinherited
projectDirectory FutureOr<Directory>
The resolved project Directory.
no setter
projectLibraryName FutureOr<String?>
The resolved project library name.
no setter
projectPackageConfigUri FutureOr<Uri>
The resolved project .dart_tool/package_config.json Uri.
no setter
projectPackageName FutureOr<String?>
The resolved project package name.
no setter
projectPubspec FutureOr<Map<String, dynamic>>
The resolved project pubspec.yaml Map.
no setter
projectPubspecFile FutureOr<File>
The resolved project pubspec.yaml file.
no setter
projectPubspecLock FutureOr<Map<String, dynamic>>
The resolved project pubspec.lock file as YamlMap.
no setter
projectPubspecLockFile FutureOr<File>
The resolved project pubspec.lock File.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cleanDartPubGetGeneratedFiles({required String confirmProjectName, bool verbose = false}) Future<bool>
Deletes files generated by dart pub get:
ensureProjectDependenciesResolved() Future<bool>
Ensures that projectDirectory has the dependencies resolved. If not resolved runs dart pub get, calling runDartPubGet.
executablePath(String executableName, {bool refresh = false}) Future<String?>
Returns an executable binary path for executableName.
existsProjectPackageConfigUri() FutureOr<bool>
Returns true if projectPackageConfigUri exists.
getProjectDependencyVersion(String package) FutureOr<String?>
Returns the version string of package at the target project dependencies.
log(String type, dynamic message) → void
Logs a message.
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.
projectSubFile(String filePath) FutureOr<File>
Returns a sub-File inside projectDirectory.
projectSubUri(String filePath) FutureOr<Uri>
Returns a sub-Uri inside projectDirectory.
runDartPubGet() Future<bool>
Runs dart pub get in the projectDirectory.
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.
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.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

getFreeListenPort({Iterable<int>? ports, Iterable<int>? skipPort, int? startPort, int? endPort, bool shufflePorts = false, Duration? testTimeout}) Future<int?>
Returns a ServerSocket port free to listen.
isFreeListenPort(int port, {Duration? testTimeout}) Future<bool>
Returns true if port is free to listen.