pub library

Classes

DartExecutableWithPackageConfig
The result of a getExecutableForCommand command resolution.
ProgressGracePeriod
Tracks elapsed time and progress display state to debounce initial spinners across a group of related operations.

Enums

CommandResolutionIssue
Information on why no executable is returned.
SolveReportMode
The level of reporting to output upon successful dependency resolution.

Functions

ensurePubspecResolved(String dir, {bool isOffline = false, SolveReportMode reportMode = SolveReportMode.none, bool onlyOutputWhenTerminal = true, ProgressGracePeriod? progressGracePeriod, FileSystem? fileSystem, Map<String, String>? environment, String? platformVersion, Stream<List<int>>? stdin, StreamSink<List<int>>? stdout, StreamSink<List<int>>? stderr, Client? httpClient}) → Future<void>
Makes sure that dir/pubspec.yaml is resolved such that pubspec.lock and .dart_tool/package_config.json are up-to-date and all packages are downloaded to the cache.
getExecutableForCommand(String descriptor, {bool allowSnapshot = false, String? root, String? pubCacheDir}) → Future<DartExecutableWithPackageConfig>
Returns the dart program/snapshot to invoke for running descriptor resolved according to the package configuration of the package at root (defaulting to the current working directory). Using the pub-cache at pubCacheDir (defaulting to the default pub cache).
getPackageNameFromGitRepo(String url, {String? ref, String? path, String? tagPattern, String? relativeTo, bool isOffline = false}) → Future<String>
Given a Git repo that contains a pub package, gets the name of the pub package.
pubCommand({required bool isVerbose(), String category = '', ProgressGracePeriod? progressGracePeriod, FileSystem? fileSystem, Map<String, String>? environment, String? platformVersion, Stream<List<int>>? stdin, StreamSink<List<int>>? stdout, StreamSink<List<int>>? stderr, Client? httpClient}) → Command<int>
Returns a Command for pub functionality that can be used by an embedding CommandRunner.
withProgressGracePeriod<R>(R callback(), {required ProgressGracePeriod progressGracePeriod}) → R
Runs callback in a Zone with progressGracePeriod as the active grace period.

Exceptions / Errors

CommandResolutionFailedException
Indicates that a command string did not resolve to an executable.
ResolutionFailedException
Exception thrown when package resolution fails in ensurePubspecResolved.