codenic_bloc_use_case library

Classes

BaseUseCase<P, L, R>
An abstract class for the core functionalities of a use case.
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.
DistinctCubit<S>
A Cubit that enables state emission from one method call at a time.
Either<L, R>
Represents a value of one of two possible types, Left or Right.
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.
Equatable
A base class to facilitate operator == and hashCode overrides.
EquatableConfig
The default configurion for all Equatable instances.
ErrorSink
A generic destination for errors.
Left<L, R>
RunFailed<L>
The state emitted when Runner.run call fails.
Runner<P, L, R>
An abstract use case for executing tasks asynchronously via a cubit which accepts a P parameter and emits either an L failed value or an R success value.
RunnerInitial
The initial state of the Runner when Runner.run has not been called yet or has been reset.
RunnerState
The root class of all states emitted by Runner.
Running
The initial state emitted when Runner.run is called.
RunSuccess<R>
The state emitted when a Runner.run call succeeds.
StartWatchFailed<L>
The state emitted when Watcher.watch call fails.
StartWatching
The initial state emitted when Watcher.watch is called.
StartWatchSuccess<R extends VerboseStream>
The state emitted when a Watcher.watch call succeeds.
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.
VerboseStream<LE, RE>
A stream wrapper that enforces a stream to explicitly return either LE or RE values.
WatchDataReceived<RE>
The state emitted when the Watcher.watch-created stream emits a data event.
WatchDone
The state emitted when the Watcher.watch-created stream closes.
Watcher<P, L, R>
An abstract use case for running a stream asynchronously via a cubit which accepts a P parameter for creating the stream.
WatcherInitial
The initial state of the Watcher when Watcher.watch has not been called yet or has been reset.
WatchErrorReceived<LE>
The state emitted when the Watcher.watch-created stream emits an error event.
WatcherState
The root class of all states emitted by Watcher.

Mixins

EquatableMixin
A mixin that helps implement equality without needing to explicitly override operator == and hashCode.

Extensions

EitherExtension on Either<L, R>
Extension for Either to get the value of Right or Left.

Functions

ensureAsync() Future<void>
Called on state emitting methods to make them truly asynchronous.

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.