refena library

Classes

AbstractChangeEvent<T>
A flag that is applied for ChangeEvent and RebuildEvent.
ActionDispatchedEvent
An action has been dispatched. Usually, a ChangeEvent directly follows this event. If the action is asynchronous, the ChangeEvent can be delayed.
ActionErrorEvent
An action threw an error.
ActionFinishedEvent
An action has been finished successfully.
AsyncData<T> Async Value
The data of an AsyncValue.
AsyncError<T> Async Value
The error of an AsyncValue.
AsyncGlobalAction Redux
An asynchronous global action without a result.
AsyncGlobalActionWithResult<R> Redux
An asynchronous global action with a result.
AsyncLoading<T> Async Value
The loading state of an AsyncValue.
AsyncNotifier<T>
An AsyncNotifier is a notifier that holds the state of an AsyncSnapshot. It is used for business logic that depends on asynchronous operations.
AsyncNotifierProvider<N extends AsyncNotifier<T>, T>
Use an AsyncNotifierProvider to implement a stateful provider. Changes to the state are propagated to all consumers that called watch on the provider.
AsyncNotifierTester<N extends BaseAsyncNotifier<T>, T>
A wrapper for BaseAsyncNotifier that exposes setState and state. It creates a container internally, so any ref call still works. This is useful for unit tests.
AsyncReduxAction<N extends ReduxNotifier<T>, T> Redux
The asynchronous action that is dispatched by a ReduxNotifier. Trigger this with dispatchAsync.
AsyncReduxActionWithResult<N extends ReduxNotifier<T>, T, R> Redux
The asynchronous action that is dispatched by a ReduxNotifier.
AsyncValue<T> Async Value
BaseReduxAction<N extends ReduxNotifier<T>, T, R>
The action that is dispatched by a ReduxNotifier. You should use ReduxAction or AsyncReduxAction instead.
ChangeEvent<T>
The most frequent event. A notifier changed its state and notifies all listeners that they should rebuild.
ChangeNotifier
A notifier that can trigger notifyListeners to trigger rebuilds. It has access to Ref for fast development.
ChangeNotifierProvider<N extends ChangeNotifier>
Use a NotifierProvider to implement a stateful provider. Changes to the state are propagated to all consumers that called watch on the provider.
Dispatcher<N extends ReduxNotifier<T>, T>
A proxy class to provide a custom debugOrigin for dispatch.
FamilyNotifier<T, F, P extends BaseProvider<BaseNotifier<T>, T>>
The family notifier manages a map of notifiers, one for each parameter. They are created lazily when the parameter is accessed for the first time.
FutureFamilyProvider<T, P>
A FutureFamilyProvider is a special version of FutureProvider that allows you to watch a collection of Futures.
FutureProvider<T>
A FutureProvider allows you to watch a Future in your widgets. The value is cached and only fetched once.
FutureProviderNotifier<T>
The corresponding notifier of a FutureProvider.
GlobalAction Redux
A synchronous global action without a result.
GlobalActionDispatcher
GlobalActionWithResult<R> Redux
A synchronous global action with a result.
GlobalRedux
The corresponding global redux notifier.
HistoryObserverConfig
The configuration of the RefenaHistoryObserver. It defines which events are saved.
IdReference
An arbitrary object that has a refenaId. We cannot rely on identical() because this information cannot be serialized.
ImmutableNotifier<T>
A notifier that is immutable. The state of the notifier is provided in the constructor.
LabeledIdReference
An arbitrary object that is a IdReference and a LabeledReference.
LabeledReference
An arbitrary object that has a debugLabel property.
MessageEvent
A custom message. This is useful for debugging.
Notifier<T>
A notifier holds a state and notifies its listeners when the state changes. Listeners are added automatically when calling WatchableRef.watch.
NotifierEvent<T>
The object that gets fired by the stream.
NotifierProvider<N extends BaseSyncNotifier<T>, T>
Use a NotifierProvider to implement a stateful provider. Changes to the state are propagated to all consumers that called watch on the provider.
NotifierSnapshot<T>
A snapshot of the AsyncNotifier.
NotifierTester<N extends BaseSyncNotifier<T>, T>
A wrapper for BaseSyncNotifier that exposes setState and state. It creates a container internally, so any ref call still works. This is useful for unit tests.
Provider<T>
Use a Provider to implement a stateless provider. Useful for dependency injection. Often used with overrideWithValue during initialization of the app.
ProviderDisposeEvent
A provider has been disposed. This does not happen automatically but only when ref.dispose(provider) is called.
ProviderInitEvent
A provider is initialized (happens only once per runtime). This happens either immediately during provider override or lazily when the provider is accessed the first time.
ProviderOverride<N extends BaseNotifier<T>, T>
Instructs Refena to set a predefined state for a provider.
PureNotifier<T>
A Notifier but without Ref making this notifier self-contained.
Rebuildable
Something that can be rebuilt. It might be
RebuildEvent<T>
A ViewProvider has been rebuilt. (NOT widget rebuild) This is very similar to a ChangeEvent but instead of one action, there can be multiple pairs of actions and notifiers.
ReduxAction<N extends ReduxNotifier<T>, T> Redux
The action that is dispatched by a ReduxNotifier. Trigger this with dispatch.
ReduxActionWithResult<N extends ReduxNotifier<T>, T, R> Redux
The action that is dispatched by a ReduxNotifier.
ReduxNotifier<T> Redux
A notifier where the state is updated by dispatching actions.
ReduxNotifierTester<T>
A wrapper for BaseReduxNotifier that exposes setState and state. This is useful for unit tests.
ReduxProvider<N extends ReduxNotifier<T>, T> Redux
Holds a ReduxNotifier
Ref Introduction
A Ref is used to access the state of providers. It lives as long as the RefenaContainer lives since it is just a proxy to access the state.
RefenaCallbackObserver
An observer where you can specify the behavior right in the constructor. This is useful for testing to avoid boilerplate code.
RefenaContainer Introduction Riverpod Initialization
The RefenaContainer holds the state of all providers. Every provider is initialized lazily.
RefenaDebugObserver
A plug-and-play RefenaObserver that prints every action into the console for easier debugging.
RefenaEvent
The base event.
RefenaHistoryObserver Testing
An observer that stores every event in a list. This is useful for testing to keep track of the events.
RefenaMultiObserver
The observer to use multiple observers at once.
RefenaObserver
The observer receives every RefenaEvent. It is up to the implementation of how to use it.
RefenaTracingObserver
A more sophisticated version of RefenaHistoryObserver. This should be used in combination with RefenaTracingPage.
RefreshAction<N extends ReduxNotifier<AsyncValue<T>>, T>
An action that refreshes the state of a ReduxNotifier. The state must be an AsyncValue with the data type T.
RefreshSetErrorAction<N extends ReduxNotifier<AsyncValue<T>>, T>
Sets the state of a ReduxNotifier to AsyncValue.withError.
RefreshSetLoadingAction<N extends ReduxNotifier<AsyncValue<T>>, T>
Sets the state of a ReduxNotifier to AsyncValue.loading.
StateAccessor<R> Dependency Injection
Provides access to the latest state of a provider.
StateNotifier<T>
A pre-implemented notifier for simple use cases. You may add a listener to retrieve every setState event.
StateProvider<T>
A StateProvider is a custom implementation of a NotifierProvider that implements a default notifier with a setState method.
StreamFamilyProvider<T, P>
A StreamFamilyProvider is a special version of StreamProvider that allows you to watch a collection of Streams.
StreamProvider<T>
A provider that listens to a Stream and exposes its latest value.
StreamProviderNotifier<T>
The corresponding notifier of a StreamProvider.
TracingNotifier
ViewFamilyProvider<T, P>
Similar to ViewProvider but with a parameter. It is essentially a syntax sugar for ViewProvider<Map<P, T>>.
ViewProvider<T>
The ViewProvider is the only provider that can watch other providers. Its builder is similar to a normal Provider. A common use case is to define a view model that depends on many providers. Don't worry about the ref, you can use it freely inside any function. The ref will never become invalid.
ViewProviderNotifier<T>
WatchableRef
This type of Ref available in the build method of rebuildable providers. In Flutter, it is available as BuildContext.ref or with the Refena mixin.
WatchAction<N extends ReduxNotifier<T>, T> Redux
TLDR: This action reruns the reduce method whenever a watched provider changes.
WatchActionSubscription
A handle to cancel a WatchAction. Usually this is not needed as the WatchAction is automatically cancelled when the ReduxNotifier is disposed.
WatchUpdateAction<N extends ReduxNotifier<T>, T>
A simple action that updates the state.

Enums

ActionLifecycle
The location of an error.
NotifyStrategy
This enum controls the default behaviour of updateShouldNotify. Keep in mind that you can override updateShouldNotify in your notifiers to implement a custom behaviour.
PlatformHint
This type is used to represent the platform type without depending on Flutter or dart:io.
ProviderInitCause

Mixins

GlobalActions<N extends ReduxNotifier<T>, T, R>
RebuildableNotifier<T, R>
A notifier that can be rebuilt. In other words: The provider build lambda can be called again without the notifier being disposed.

Properties

globalReduxProvider ReduxProvider<GlobalRedux, void> Redux
The global redux provider.
final
tracingProvider ChangeNotifierProvider<TracingNotifier>
final

Typedefs

ErrorParser = Map<String, dynamic>? Function(Object error)
Parses an error to a map. This is used by the tracing page to display the error in a human-readable format. This is also used by the RefenaInspectorObserver to to send the error to the inspector.
FutureFamilyBuilder<T, P> = Future<T> Function(WatchableRef ref, P param)
MockGlobalReducer = void Function(Ref ref)
Function type for a mocked global reducer.
MockReducer<T> = Object? Function(T state)
Function type for a mocked reducer.
ProviderChangedCallback<T> = void Function(T prev, T next, Ref ref)
A callback that is called when a provider changes.
StreamFamilyBuilder<T, P> = Stream<T> Function(WatchableRef ref, P param)
ViewFamilyBuilder<T, P> = T Function(WatchableRef ref, P param)