PackageUtils class abstract

Utility class for resolving and caching Dart packages at runtime.

PackageUtils provides static methods to locate Package instances from the runtime, cache them for efficient access, and avoid redundant scans.

It works in combination with a runtime reflection system, where available packages can be discovered via Runtime.getAllPackages().

Example:

final package = PackageUtils.getPackage('my_library');
print(package.name);

If the package is not found during lookup, an Exception will be thrown.

This utility is helpful in frameworks that need to access package metadata, scan classes, or perform analysis on Dart packages.

Constructors

PackageUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

getPackage(String name) → Package?
Utility class for resolving and caching Dart packages at runtime.