ArcaneFieldDirectProvider<T> class
A flexible concrete implementation of ArcaneFieldProvider that delegates value retrieval and storage to custom asynchronous functions.
This provider allows integration with external data sources, databases, or APIs by providing user-defined getter and setter functions.
It supports any storage mechanism while maintaining reactive updates through the BehaviorSubject. Ideal for forms in ArcaneForm
that require custom persistence, such as syncing with remote services or legacy systems. Works with ArcaneField and FieldNode
for dynamic form handling, with error fallback to defaultValue on get failures.
- Inheritance
-
- Object
- ArcaneFieldProvider<
T> - ArcaneFieldDirectProvider
Constructors
-
ArcaneFieldDirectProvider({required T defaultValue, required Future<
T> getter(String), required Future<void> setter(String, T)}) - Initializes an ArcaneFieldDirectProvider with a default value and custom getter/setter functions.
Properties
- defaultValue → T
-
The default value used as a fallback when value retrieval fails (e.g., key not found or error in onGetValue).
finalinherited
-
getter
→ Future<
T> Function(String) -
The asynchronous function to retrieve a value by key, returning a Future<T>.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
setter
→ Future<
void> Function(String, T) -
The asynchronous function to set a value by key, accepting a Future<void> return.
final
-
subject
↔ BehaviorSubject<
T> -
The reactive BehaviorSubject<T> that broadcasts current field values to listeners, enabling real-time UI updates.
getter/setter pairinherited
Methods
-
getValue(
String k) → Future< T> -
Asynchronously retrieves the value for the given key, falling back to defaultValue on any error from onGetValue.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onGetValue(
String k) → Future< T> -
Delegates to the provided getter function to asynchronously retrieve the value for the key.
override
-
onSetValue(
String k, T value) → Future< void> -
Delegates to the provided setter function to asynchronously store the value for the key.
override
-
setValue(
String k, T value) → Future< void> -
Asynchronously sets the value for the given key using onSetValue, then emits the new value to the subject.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited