PackageFileResolver class abstract

Abstract interface for resolving package file paths in a Dart project.

This resolver handles the translation between different URI schemes used by Dart (package:, asset:, dart:) and absolute file system paths. It's responsible for determining which package a file belongs to and normalizing URI references.

Constructors

PackageFileResolver.forRoot()
Creates a resolver for the current working directory.
factory
PackageFileResolver.fromJson(Map<String, dynamic> data)
Creates a resolver from a serialized JSON representation.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
packages Set<String>
The set of available package names known to this resolver.
no setter
packagesHash String
A hash of the package configuration, used for caching and invalidation.
no setter
rootPackage String
The name of the root package for this resolver.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

assetForUri(Uri uri, {Asset? relativeTo}) Asset
Creates an Asset object for the specified URI.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
packageFor(Uri uri, {Uri? relativeTo}) String
Returns the package name that contains the specified URI.
pathFor(String package) String
Returns the absolute path for a package.
resolveFileUri(Uri uri, {Uri? relativeTo}) Uri
Resolves a URI to an absolute URI on the file system.
toJson() Map<String, dynamic>
Serializes this resolver to a JSON-compatible format.
toShortUri(Uri uri) Uri
Converts an absolute URI to a short, reversible form.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

dartSdkPath Uri
The absolute URI path to the Dart SDK on the system.
final

Static Methods

isDirSupported(String? scheme) bool
Checks if a given directory scheme is supported by this resolver.

Constants

dartSdk → const String
Special identifier for the Dart SDK in package paths.
dirsScheme → const Map<String, String>
Mapping of directory names to URI schemes.