ResourceController<T> class

Reactive controller for loading and refreshing API data.

A resource is Flint UI's recommended shape for data that comes from a FlintDart endpoint. It keeps request status, current data, errors, and local optimistic updates in one signal.

Constructors

ResourceController({required ResourceLoader<T> loader, T? initialData, bool loadImmediately = false})
Creates a resource controller.

Properties

data → T?
Current data, when available.
no setter
hashCode int
The hash code for this object.
no setterinherited
loader ResourceLoader<T>
The function used to fetch fresh data.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
snapshot ResourceSnapshot<T>
Current resource snapshot.
no setter
state StateSignal<ResourceSnapshot<T>>
Reactive snapshot signal.
final

Methods

dispose() → void
Clears listeners owned by this resource.
load({bool silent = false}) Future<T?>
Loads fresh data.
mutate(T updater(T? current)) → void
Applies a local mutation to the current data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh({bool silent = false}) Future<T?>
Alias for load used by dashboard refresh buttons.
setData(T data) → void
Replaces the current data.
setError(Object error) → void
Marks the resource as failed.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited