ensurePubspecResolved function
Future<void>
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< ? stdin,int> > - StreamSink<
List< ? stdout,int> > - StreamSink<
List< ? stderr,int> > - Client? httpClient,
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.
Will compare file timestamps to see if full resolution can be skipped.
reportMode specifies the level of reporting output on success. Defaults
to SolveReportMode.none (no output).
If onlyOutputWhenTerminal is true (the default) there will be no
output if no terminal is attached.
progressGracePeriod specifies the shared grace period before initial
spinners are displayed.
Throws a ResolutionFailedException if resolution fails.
Implementation
Future<void> ensurePubspecResolved(
String dir, {
bool isOffline = false,
SolveReportMode reportMode = SolveReportMode.none,
bool onlyOutputWhenTerminal = true,
ProgressGracePeriod? progressGracePeriod,
f.FileSystem? fileSystem,
Map<String, String>? environment,
String? platformVersion,
Stream<List<int>>? stdin,
StreamSink<List<int>>? stdout,
StreamSink<List<int>>? stderr,
http.Client? httpClient,
}) => withOverrides(
() async {
try {
await Entrypoint.ensureUpToDate(
dir,
cache: SystemCache(isOffline: isOffline),
reportMode: reportMode,
onlyOutputWhenTerminal: onlyOutputWhenTerminal,
);
} on ApplicationException catch (e) {
throw ResolutionFailedException._(e.toString());
} finally {
// TODO(https://github.com/dart-lang/pub/issues/4200)
// This is a bit of a hack.
// We should most likely take a client here.
globalHttpClient.close();
}
},
progressGracePeriod: progressGracePeriod,
fileSystem: fileSystem,
environment: environment,
platformVersion: platformVersion,
stdin: stdin,
stdout: stdout,
stderr: stderr,
httpClient: httpClient,
);