Provider<T> class abstract interface

A generic provider interface for supplying instances of type T.

Provider abstracts the creation or retrieval of an object, allowing flexible, lazy, or pre-configured provisioning of dependencies or values.

Responsibilities

  • Supply instances of type T to consumers.
  • Decouple object creation from object usage.
  • Can be implemented for lazy, singleton, or dynamic provisioning.

Example

final provider = SimpleProvider<int>(42);
print(provider.get()); // 42

See Also

Mixed-in types
Implementers

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

equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
inherited
get() → T
Returns an instance of type T.
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