ScopedProvider<T> class
A provider that can be scoped and overridden within specific contexts. Useful for testing and dependency injection scenarios.
- Inheritance
-
- Object
- BaseProvider<
T> - ScopedProvider
Constructors
- ScopedProvider.new(T _creator(), {bool singleton = false})
-
Creates a scoped provider with a creator function.
If
singleton
is true, the created instance will be cached. - ScopedProvider.value(T value)
- Creates a scoped provider that always returns the given value.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasOverride → bool
-
Gets whether this provider has an active override.
no setter
- id → String
-
Gets a unique identifier for this provider.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearOverride(
) → void - Clears any override, returning to the original creator function.
-
create(
) → T -
Creates an instance of type T.
override
-
dispose(
) → void -
Optional cleanup method that can be overridden by subclasses.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overrideWithProvider(
ScopedProvider< T> provider) → void - Overrides the provider with a new creator function.
-
overrideWithValue(
T value) → void - Overrides the provider with a specific value.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited