flutter_value_bloc library

Classes

ActionDataCubitBuilder<TDataCubit extends DataCubit<DataState<TFailure, TData>, TFailure, TData>, TFailure, TData>
AuthCubit<TFailure, TSuccess>
AuthCubitAuthorized<TFailure, TSuccess>
AuthCubitAuthorizing<TFailure, TSuccess>
AuthCubitReauthorizing<TFailure, TSuccess>
AuthCubitState<TFailure, TSuccess>
AuthCubitUnauthorized<TFailure, TSuccess>
AuthCubitUnauthorizing<TFailure, TSuccess>
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.
BlocBuilder<B extends BlocBase<S>, S>
BlocBuilder handles building a widget in response to new states. BlocBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed as well as bloc-specific performance improvements. Please refer to BlocListener if you want to "do" anything in response to state changes such as navigation, showing a dialog, etc...
BlocBuilderBase<B extends BlocBase<S>, S>
Base class for widgets that build themselves based on interaction with a specified bloc.
BlocConsumer<B extends BlocBase<S>, S>
BlocConsumer exposes a builder and listener in order react to new states. BlocConsumer is analogous to a nested BlocListener and BlocBuilder but reduces the amount of boilerplate needed. BlocConsumer should only be used when it is necessary to both rebuild UI and execute other reactions to state changes in the bloc.
BlocListener<B extends BlocBase<S>, S>
Takes a BlocWidgetListener and an optional bloc and invokes the listener in response to state changes in the bloc. It should be used for functionality that needs to occur only in response to a state change such as navigation, showing a SnackBar, showing a Dialog, etc... The listener is guaranteed to only be called once for each state change unlike the builder in BlocBuilder.
BlocListenerBase<B extends BlocBase<S>, S>
Base class for widgets that listen to state changes in a specified bloc.
BlocObserver
An interface for observing the behavior of Bloc instances.
BlocProvider<T extends BlocBase<Object?>>
Takes a Create function that is responsible for creating the Bloc or Cubit and a child which will have access to the instance via BlocProvider.of(context). It is used as a dependency injection (DI) widget so that a single instance of a Bloc or Cubit can be provided to multiple widgets within a subtree.
BlocSelector<B extends BlocBase<S>, S, T>
BlocSelector is analogous to BlocBuilder but allows developers to filter updates by selecting a new value based on the bloc state. Unnecessary builds are prevented if the selected value does not change.
Change<State>
A Change represents the change from one State to another. A Change consists of the currentState and nextState.
Closer
CloserEntry
CloserProvider
CollectionCubit<Value, ExtraData>
Cubit<State>
A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
CubitViewBuilder<C extends Cubit<S>, S extends Object>
CubitViews
It defines default ErrorViewBuilder, LoaderViewBuilder, EmptyViewBuilder
CubitViewsProvider
It provider in SingleViewValueCubitBuilder or ListViewValueCubitBuilder the defaults builders
CudCubit<RawValue, PartialValue, Value>
CudCubitCreated<RawValue, PartialValue, Value>
CudCubitCreating<RawValue, PartialValue, Value>
CudCubitDeleted<RawValue, PartialValue, Value>
CudCubitDeleting<RawValue, PartialValue, Value>
CudCubitIdle<RawValue, PartialValue, Value>
CudCubitState<RawValue, PartialValue, Value>
CudCubitUpdated<RawValue, PartialValue, Value>
CudCubitUpdating<RawValue, PartialValue, Value>
DataCubit<TState extends DataState<TFailure, TData>, TFailure, TData>
DataCubitBuilder<TDataBloc extends DataCubit<DataState<TFailure, TSuccess>, TFailure, TSuccess>, TFailure, TSuccess>
DataCubitListener<TDataCubit extends DataCubit<DataState<TFailure, TData>, TFailure, TData>, TFailure, TData>
DataCubitListenerBase<TDataCubit extends DataCubit<TState, TFailure, TData>, TState extends DataState<TFailure, TData>, TFailure, TData>
DataState<TFailure, TData>
DelegateEntry
DynamicCubit<State>
Emitter<State>
An Emitter is a class which is capable of emitting new states.
EmptyFetchEvent<V>
FailedFetchEvent<V>
GridViewCubitBuilder<Value extends Object>
IterableCubit<Value, ExtraData>
IterableCubitBuilderBase<Value>
IterableCubitState<Value, ExtraData>
IterableCubitUpdated<Value, ExtraData>
The job list has been updated.
IterableCubitUpdateFailed<Value, ExtraData>
The job is failed.
IterableCubitUpdating<Value, ExtraData>
The job list is being updated.
IterableFetchedEvent<V>
ListCubit<Value, ExtraData>
ListDataCubit<TFailure, TData>
ListDataCubitBase<TFailure, TData>
ListViewCubitBuilder<Value extends Object>
LoadCubit<ExtraData>
LoadCubitFailed<ExtraData>
LoadCubitIdle<ExtraData>
LoadCubitLoaded<ExtraData>
LoadCubitLoading<ExtraData>
LoadCubitState<ExtraData>
MapDataCubit<TFailure, TData>
MapDataCubitBase<TFailure, TData>
ModularBloc<Event, State>
See ModularCubitMixin
ModularCubit<State>
See ModularCubitMixin
ModularViewCubitBuilder<C extends ModularCubitMixin<S>, S>
ModularViewCubitConsumer<C extends ModularCubitMixin<S>, S>
MultiBlocListener
Merges multiple BlocListener widgets into one widget tree.
MultiBlocProvider
Merges multiple BlocProvider widgets into one widget tree.
MultiCubit<Value, Filter, ExtraData>
Allows you to fetch data in a secure and paginated way using the fetcher function
MultiDataCubit<TFailure, TData>
MultiDataCubitBuilder<TDataBloc extends MultiDataCubit<TFailure, TSuccess>, TFailure, TSuccess>
MultiDataCubitListener<TDataCubit extends DataCubit<MultiDataState<TFailure, TData>, TFailure, BuiltList<TData>>, TFailure, TData>
MultiDataState<TFailure, TData>
MultiFetchEvent<V>
MultiRepositoryProvider
Merges multiple RepositoryProvider widgets into one widget tree.
ObjectCubit<Value, ExtraData>
ObjectCubitState<Value, ExtraData>
ObjectCubitUpdated<Value, ExtraData>
ObjectCubitUpdateFailed<Value, ExtraData>
ObjectCubitUpdating<Value, ExtraData>
ObjectDataCubit<TFailure, TData>
ObjectDataCubitBase<TFailure, TData>
ObjectFetchedEvent<V>
PageOffset
It represent a request for retrieving a values determined by startAt and length
PaginatedDataTableCubitBuilder<V>
Build a PaginatedDataTable with ListValueCubit
RepositoryProvider<T>
Takes a Create function that is responsible for creating the repository and a child which will have access to the repository via RepositoryProvider.of(context). It is used as a dependency injection (DI) widget so that a single instance of a repository can be provided to multiple widgets within a subtree.
ScrollViewCubitBuilder<Value extends Object>
ScrollViewCubitBuilderBase<Value extends Object>
ScrollViewDataCubitBuilder<TDataCubit extends MapDataCubitBase<TFailure, TData>, TFailure, TData>
SetCubit<Value, ExtraData>
SingleCubit<Value, Filter, ExtraData>
It allows you to wait for the fetch of a value, if it is not successful it notifies the failure, if the value does not exist it notifies the non-existence otherwise it notifies the new value.
SingleDataState<TFailure, TData>
SingleFetchEvent<V>
Transition<Event, State>
A Transition is the change from one state to another. Consists of the currentState, an event, and the nextState.
ValueCubit<Value, ExtraData>
Allows you to wait for the loading of a value, if it is not successful it notifies the failure otherwise it notifies the new value
ViewBuilder
This is a view builder with default ErrorViewBuilder, LoadingViewBuilder, EmptyViewBuilder
ViewCubitBuilder<Value>
ViewDataCubitBuilder<TDataCubit extends SingleDataCubit<DataState<TFailure, TData>, TFailure, TData>, TFailure, TData>
ViewDataCubitTheme<TFailure>
Views
It defines default ErrorViewBuilder, LoadingViewBuilder, EmptyViewBuilder
ViewsProvider
It provider in ViewBuilder, SingleViewValueCubitBuilder or ListViewValueCubitBuilder the defaults builders

Enums

DataStatus

Mixins

BlocCloser<State>
It allows you to automatic close Cubit with CloseableBlocExtension It allows you to automatic unsubscribe to a StreamSubscription with CloseableStreamSubscriptionExtension
LoadCubitModule<ExtraData, State>
ModularCubitMixin<State>
It allows you to combine several modules into a single cubit
SingleDataCubit<TState extends DataState<TFailure, TData>, TFailure, TData>

Typedefs

BlocBuilderCondition<S> = bool Function(S previous, S current)
Signature for the buildWhen function which takes the previous state and the current state and is responsible for returning a bool which determines whether to rebuild BlocBuilder with the current state.
BlocListenerCondition<S> = bool Function(S previous, S current)
Signature for the listenWhen function which takes the previous state and the current state and is responsible for returning a bool which determines whether or not to call BlocWidgetListener of BlocListener with the current state.
BlocWidgetBuilder<S> = Widget Function(BuildContext context, S state)
Signature for the builder function which takes the BuildContext and state and is responsible for returning a widget which is to be rendered. This is analogous to the builder function in StreamBuilder.
BlocWidgetListener<S> = void Function(BuildContext context, S state)
Signature for the listener function which takes the BuildContext along with the state and is responsible for executing in response to state changes.
BlocWidgetSelector<S, T> = T Function(S state)
Signature for the selector function which is responsible for returning a selected value, T, based on state.
CubitValueWidgetBuilder<V> = Widget Function(BuildContext context, V value)
DecorationWidgetBuilder = Widget Function(BuildContext context, Widget child)
EmptyCubitViewBuilder<C extends Cubit, S> = Widget Function(BuildContext context, C cubit, S State)
It build a widget for showing a empty list or empty screen Center(child: Text('Empty'))
EmptyViewBuilder = Widget Function(BuildContext context)
It build a widget for showing a empty list or empty screen Center(child: Text('Empty'))
Equalizer<T> = bool Function(T a, T b)
ErrorCubitViewBuilder<C extends Cubit, S> = Widget Function(BuildContext context, C cubit, S State)
It build a widget for showing a error Ex. Center(child: Text('$error'))
ErrorViewBuilder = Widget Function(BuildContext context, Object? error)
It build a widget for showing a error Ex. Center(child: Text('$error'))
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.
GroupDataReader = void Function(PageOffset offset)
Indexer<T> = int Function(T value)
ListDataReader = void Function()
ListFetcher<Value, Filter> = Stream<MultiFetchEvent<Iterable<Value>>> Function(PageOffset section, Filter filter)
Loader = void Function()
LoadingCubitViewBuilder<C extends Cubit, S> = Widget Function(BuildContext context, C cubit, S state)
It build a widget for showing a progress Ex. Center(child: CircularProgressIndicator(value: progress))
LoadingViewBuilder = Widget Function(BuildContext context, double? progress)
It build a widget for showing a progress Ex. Center(child: CircularProgressIndicator(value: progress))
ObjectDataReader = void Function()
TransitionFunction<Event, State> = Stream<Transition<Event, State>> Function(Event)
@Deprecated - Use on<Event> with an EventTransformer instead. Will be removed in v8.0.0
ValueFetcher<Value, Filter> = Stream<SingleFetchEvent<Value>> Function(Filter? filter)

Exceptions / Errors

BlocUnhandledErrorException
Exception thrown when an unhandled error occurs within a bloc.
ProviderNotFoundException
The error that will be thrown if Provider.of fails to find a Provider as an ancestor of the BuildContext used.