codenic_bloc_use_case library

Classes

AdvancedFileOutput
Accumulates logs in a buffer to reduce frequent disk, writes while optionally switching to a new log file if it reaches a certain size.
AnsiColor
This class handles colorizing of terminal output.
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.
CodenicLogger
Creates a logger that appropriately displays information from a MessageLog.
ConsoleOutput
Default implementation of LogOutput.
Cubit<State>
A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
DateTimeFormat
DevelopmentFilter
Prints all logs with level >= Logger.level while in development mode (eg when asserts are evaluated, Flutter calls this debug mode).
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 configuration for all Equatable instances.
ErrorSink
A generic destination for errors.
ExceptionConverter<E extends Exception, T>
An abstract class that converts an exception E to a Failure if exception E occurs while running observe .
ExceptionConverterSuite
An abstract class that converts an exception E to a Failure if exception E occurs while running observe .
Failure
A base class for all failures.
FileOutput
HybridPrinter
A decorator for a LogPrinter that allows for the composition of different printers to handle different log messages. Provide it's constructor with a base printer, but include named parameters for any levels that have a different printer:
Left<L, R>
LogEvent
LogFilter
An abstract filter of log messages.
LogfmtPrinter
Outputs a logfmt message:
Logger
Use instances of logger to send log messages to the LogPrinter.
LogOutput
Log output receives a OutputEvent from LogPrinter and sends it to the desired destination.
LogPrinter
An abstract handler of log events.
MemoryOutput
Buffers OutputEvents.
MessageLog
A container for log information.
MessageLogPrinter
An extension of PrettyPrinter that displays the content of a MessageLog and prevents long texts from being truncated.
MultiOutput
Logs simultaneously to multiple LogOutput outputs.
OutputEvent
PrefixPrinter
A decorator for a LogPrinter that allows for the prepending of every line in the log output with a string for the level of that log. For example:
PrettyPrinter
Default implementation of LogPrinter.
ProductionFilter
Prints all logs with level >= Logger.level even in production.
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.
SimplePrinter
Outputs simple log messages:
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.
StreamOutput
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 a RE right event on data events, or a LE left event on error events as a replacement for the Object error.
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.

Enums

Level
Levels to control logging output. Logging can be enabled to include all levels above certain Level.

Mixins

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

Extensions

EitherExtension on Either<L, R>
Extension for the Either class.

Functions

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

Typedefs

DateTimeFormatter = String Function(DateTime time)
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.
ExceptionConverterFactory = ExceptionConverter<Exception, T> Function<T>()
A signature for ExceptionConverter factories.
LogCallback = void Function(LogEvent event)
OutputCallback = void Function(OutputEvent event)