SimpleProvider<T> class final

Simple, immutable implementation of Provider that always returns a pre-defined, constant value.

Useful for testing, configuration values, or stateless provisioning where a fixed object should be returned every time.

Example

final provider = SimpleProvider<String>("Hello, JetLeaf!");
print(provider.get()); // "Hello, JetLeaf!"

Characteristics

  • Immutable: the value cannot be changed after construction.
  • Thread-safe by default due to immutability.
Implemented types

Constructors

SimpleProvider(T _value)
Constructs a new SimpleProvider with the given _value.
const

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.
override
get() → T
Returns an instance of type T.
override
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