async_cubits library

A set of Cubits that helps to handle async operations in simple and consistent way.

Classes

AsyncCubit<T>
AsyncCubit is a cubit that loads data from some async source (eg. network, database).
AsyncCubitsLogger
Class for logging info and error messages from async_cubits package
AsyncData<T>
A state representing that asynchronous computation has succeeded with a value
AsyncError<T>
A state representing that asynchronous computation has failed with an error
AsyncLoading<T>
A state representing that the value is being fetched asynchronously (e.g. from a network call).
AsyncValue<T>
AsyncValue represents a state of an asynchronous computation.
FutureCubit<T>
FutureCubit loads data from future and emits it in safe way. The result of future is wrapped in AsyncValue.
FutureWithArgsCubit<Args, T>
FutureWithArgsCubit loads data from future and emits it in safe way. The result of future is wrapped in AsyncValue.
MutationCubit<I, O>
A cubit that handles a asynchronous mutation. The mutation is provided in the mutation method. But the mutation is invoked by the invoke method.
MutationState<T>
The state of the MutationCubit.
StreamCubit<T>
StreamCubit loads data from dataStream and emits it in safe way. The result of dataStream is wrapped in AsyncValue.

Mixins

RefreshStreamFutureCubitMixin<T>
Mixin for FutureCubit that refreshes the data (triggers refresh method) when a refresh event is received from a refreshEvents stream.

Extensions

AsyncValueExtension on AsyncValue<T>
Extension on AsyncValue providing utility methods
FutureAsyncValueExtension on Future<AsyncValue<T>>
Extension on Future<AsyncValue> providing utility methods

Typedefs

AsyncCubitLoggerError = void Function(String key, String message, Object error, StackTrace? stackTrace)
Function type for logging error messages from async_cubits package
AsyncCubitLoggerInfo = void Function(String key, String message)
Function type for logging info messages from async_cubits package