bloc_pod library

A dependency injection as alternative to provider with Pod for Bloc.

See Pod in GitHub

Classes

AsyncData<T>
Creates an AsyncValue with a data.
AsyncError<T>
Creates an AsyncValue in the error state.
AsyncLoading<T>
Creates an AsyncValue in loading state.
AsyncNotifier<T>
A Notifier implementation that is asynchronously initialized.
AsyncValue<T>
A utility for safely manipulating asynchronous data.
Bloc<Event, State>
Takes a Stream of Events as input and transforms them into a Stream of States as output.
BlocBase<State>
An interface for the core functionality implemented by both Bloc and Cubit.
BlocEventSink<Event extends Object?>
An ErrorSink that supports adding events.
BlocObserver
An interface for observing the behavior of Bloc instances.
BlocOverrides
This class facilitates overriding BlocObserver and EventTransformer. It should be extended by another class in client code with overrides that construct a custom implementation. The implementation in this class defaults to the base blocObserver and eventTransformer implementation. For example:
Change<State>
A Change represents the change from one State to another. A Change consists of the currentState and nextState.
Closable
An object that must be closed when no longer in use.
Cubit<State>
A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
Emittable<State extends Object?>
An object that can emit new states.
Emitter<State>
An Emitter is a class which is capable of emitting new states.
ErrorSink
A generic destination for errors.
Notifier<State>
A class which exposes a state that can change over time.
NotifierBase
A base class for Notifier and AsyncNotifier.
Override<T>
Override Pods.
Pod<T>
The base class for all pods.
PodConfigMixin<P extends Pod>
Configuration Mixin for Pod
PodContainer
Responsible for mapping pod's to their state.
PodFuture<F extends Pod, T>
See futurePod.
PodFutureBase<F extends Pod, T>
See futurePod.
PodNotifier<N extends Pod, T>
A Notifier Pod.
PodNotifierBase<N extends Pod, T>
PodNotifier base class.
PodStream<P extends Pod, T>
A Pod for Stream's.
PodStreamBase<P extends Pod, T>
See streamPod.
ReadPod<T>
See pod.
ReadPodBase<Value>
See pod.
Ref<Value>
Passed to the Pod.read method, allowing you to interact with other pods and manage the lifecycle of your state.
RefreshablePodFuture<F extends Pod, T>
RefreshablePod for Future's.
RefreshablePodNotifier<N extends Pod, T>
RefreshablePod for PodNotifier.
RefreshablePodStream<P extends Pod, T>
RefreshablePod for PodStream class.
RefreshableReadPod<T>
See pod.
RefreshableWritablePod<T, V>
Create a Refreshable WritablePod.
StatePod<T>
Represents an Pod that can be written to.
StateStreamable<State>
A Streamable that provides synchronous access to the current state.
StateStreamableSource<State>
A StateStreamable that must be closed when no longer in use.
Streamable<State extends Object?>
An object that provides access to a stream of states over time.
Transition<Event, State>
A Transition is the change from one state to another. Consists of the currentState, an event, and the nextState.
WritablePod<T, V>
Represents an Pod that can be written to.
WritablePodBase<T, V>
Represents an Pod that can be written to.

Mixins

RefreshablePod
RefreshablePod mixin that contains a refresh behaviour.
RefreshablePodMixin<P extends RefreshablePod>
RefreshablePodMixin that contains a refreshable method.

Extensions

AsyncNotifierX on AsyncNotifier<T>
An extension that adds methods like guard to an AsyncNotifier.
AsyncValuePodExtension on Pod<AsyncValue<T>>
AsyncValue extension.
AsyncValueX on AsyncValue<T>
An extension that adds methods like when to an AsyncValue.
PodExtension on Pod<T>
Pod extension.
PodFutureExtension on PodFuture<P, AsyncValue<V>>
PodFuture extension.

Functions

asyncNotifierPod<N extends AsyncNotifier<T>, T>(N create()) PodNotifier<Pod<N>, AsyncValue<T>>
A pod which creates and listen to an AsyncNotifier.
blocPod<B extends BlocBase<T>, T>(ReaderPod<B> create) PodNotifier<Pod<B>, T>
Create a PodNotifier for a Bloc, which exposes the latest state.
familyPod<T extends Pod, Arg>(T create(Arg arg)) → T Function(Arg arg)
Create a family factory function, for indexing similar pods with the Arg type.
futurePod<T>(ReaderPod<Future<T>> create) FuturePod<T>
Create a PodFuture that returns a AsyncValue representing the current state of the Future's execution.
internalPodNotifier<N extends Pod, T>(N notifier, T create(Ref<T> ref, N notifier)) PodNotifier<N, T>
Create a Pod that is linked to a notifier Pod.
notifierPod<N extends Notifier<T>, T>(N create()) PodNotifier<Pod<N>, T>
A pod which exposes a Notifier and listens to it.
pod<Value>(ReaderPod<Value> create) ReadPod<Value>
Create a read only pod that can interact with other pod's to create derived state.
statePod<Value>(Value initialValue) WritablePod<Value, Value>
Create a simple pod with mutable state.
streamPod<T>(ReaderPod<Stream<T>> create) StreamPod<T>
Create a Pod of a Stream.
weakFamilyPod<T extends Pod, Arg>(T create(Arg arg)) → T Function(Arg arg)
Alternate version of familyPod that holds a weak reference to each child.
writablePod<T, V>(ReaderPod<T> reader, WriterPod<T, V> writer) WritablePod<T, V>
Creates an WritablePod that can be used to implement custom write logic.

Typedefs

EventHandler<Event, State> = FutureOr<void> Function(Event event, Emitter<State> emit)
An event handler is responsible for reacting to an incoming Event and can emit zero or more states via the Emitter.
EventMapper<Event> = Stream<Event> Function(Event event)
Signature for a function which converts an incoming event into an outbound stream of events. Used when defining custom EventTransformers.
EventTransformer<Event> = Stream<Event> Function(Stream<Event> events, EventMapper<Event> mapper)
Used to change how events are processed. By default events are processed concurrently.
FuturePod<T> = PodFuture<Pod<Future<T>>, AsyncValue<T>>
Represents a PodFuture for an async operation.
GetPod = T Function<T>(Pod<T> pod)
Represents a function that retrieves an Pod's value.
ListenerCallback<T> = void Function(T state)
A listener that can be added to a NotifierBase using Notifier.addListener.
ReaderPod<T> = T Function(Ref<T> ref)
A function that creates a value from an Ref
RemoveListener = void Function()
A callback to remove a listener from notifier.
SetPod = void Function<T, V>(WritablePod<T, V> pod, V value)
Represents a function that sets a WritablePod's value.
SetSelf<T> = void Function(T value)
Represents function that sets the current pod's value
StreamPod<T> = PodStream<Pod<Stream<T>>, AsyncValue<T>>
Represents a PodStream for a streaming operation.
WriterPod<T, V> = void Function(GetPod get, SetPod set, SetSelf<T> setSelf, V value)
Represents the writer argument to writablePod

Exceptions / Errors

NotifierListenerError
An error thrown when trying to update the state of a NotifierBase, but at least one of the listeners threw.