PackageResolver class

A class that defines how to resolve package: URIs.

This includes the information necessary to resolve package: URIs using either a package config or a package root. It can be used both as a standard cross-package representation of the user's configuration, and as a means of concretely locating packages and the assets they contain.

Unlike SyncPackageResolver, this does not provide synchronous APIs. This is necessary when dealing with the current Isolate's package resolution strategy.

This class should not be implemented by user code.

Constructors

PackageResolver.config(Map<String, Uri> packageConfigMap, { dynamic uri })
Returns the package resolution strategy for the given packageConfigMap. [...]
factory
PackageResolver.root(dynamic packageRoot)
Returns the package resolution strategy for the given packageRoot, which may be a String or a Uri.
factory

Properties

asSync → Future<SyncPackageResolver>
Fetches the package resolution for this and returns an object that provides synchronous access. [...]
read-only
packageConfigMap → Future<Map<String, Uri>>
The map contained in the parsed package config. [...]
read-only
packageConfigUri → Future<Uri>
The URI for the package config. [...]
read-only
packageRoot → Future<Uri>
The base URL for resolving package: URLs. [...]
read-only
processArgument → Future<String>
Returns the argument to pass to a subprocess to get it to use this package resolution strategy when resolving package: URIs. [...]
read-only
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

packagePath(String package) → Future<String>
Returns the path on the local filesystem to the root of package, or null if the root cannot be found. [...]
packageUriFor(dynamic uri) → Future<Uri>
Returns the package: URI for uri. [...]
resolveUri(dynamic packageUri) → Future<Uri>
Resolves packageUri according to this package resolution strategy. [...]
urlFor(String package, [ String path ]) → Future<Uri>
Returns the resolved URL for package and path. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited

Static Properties

current PackageResolver
Returns package resolution strategy describing how the current isolate resolves package: URIs.
final
none PackageResolver
Returns a package resolution strategy that is unable to resolve any package: URIs.
final

Static Methods

loadConfig(dynamic uri, { Client client }) → Future<PackageResolver>
Loads a package config file from uri and returns its package resolution strategy. [...]