π« A strategy interface for selecting which imports should be applied.
ImportSelector
is an abstract interface that allows libraries or frameworks
to determine dynamically which imports to include at runtime or configuration
time. It is often used in modular application setups where certain
dependencies or components should only be imported conditionally.
Usage
Implement this interface in a class and override selects to return a list of import identifiers (usually library URIs or package paths).
class MyImportSelector implements ImportSelector {
const MyImportSelector();
@override
List<String> selects() {
return [
'package:my_app/services/user_service.dart',
'package:my_app/repositories/user_repository.dart',
];
}
}
The framework or bootstrap process can then query selects to know which imports to include.
Contract
- Classes implementing this interface must be
const
constructible. - selects must return a list of valid strings representing import URIs.
- The list may be empty if no imports are required.
See also:
ApplicationStartup
π« for orchestrating application initialization.PodFactory
π« for dependency resolution.
@since 1.0.0
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
-
selects(
) β List< ImportClass> - Returns a list of import URIs to include.
-
toString(
) β String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) β bool -
The equality operator.
inherited