flutter_value_bloc library

Classes

Bloc<Event, State>
Takes a Stream of Events as input and transforms them into a Stream of States as output.
BlocBuilder<C extends Cubit<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 cubit-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<C extends Cubit<S>, S>
Base class for widgets that build themselves based on interaction with a specified cubit. [...]
BlocConsumer<C extends Cubit<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 cubit. [...]
BlocListener<C extends Cubit<S>, S>
Takes a BlocWidgetListener and an optional cubit and invokes the listener in response to state changes in the cubit. 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<C extends Cubit<S>, S>
Base class for widgets that listen to state changes in a specified cubit. [...]
BlocObserver
An interface for observing the behavior of Bloc and Cubit instances.
BlocProvider<T extends Cubit<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. [...]
Change<State>
A Change represents the change from one State to another. A Change consists of the currentState and nextState.
Cubit<State>
A Cubit is a subset of Bloc which has no notion of events and relies on methods to emit new states. [...]
FetchedListValueState<V, Filter>
FetchedSingleValueState<V, Filter>
FetchFailedListValueState<V, Filter>
FetchFailedSingleValueState<V, Filter>
FetchingListValueState<V, Filter>
FetchingSingleValueState<V, Filter>
FetchScheme
It represent a request for retrieving a values determined by offset and limit
IdleListValueState<V, Filter>
IdleSingleValueState<V, Filter>
ListFetcher
This class perform a fetch ignoring different limit pagination You can use this class in ListValueCubit when you are interested in using paging queries with different limit
ListValueCubit<V, Filter extends Object>
ListValueState<V, Filter>
ListViewValueCubitBuilder<C extends ListValueCubit<V, Filter>, V, Filter>
it is a ViewValueCubitBuilderBase for ListValueCubit
LoadedListValueState<V, Filter>
LoadFailedListValueState<V, Filter>
LoadFailedSingleValueState<V, Filter>
LoadingListValueState<V, Filter>
LoadingSingleValueState<V, Filter>
MultiBlocListener
Merges multiple BlocListener widgets into one widget tree. [...]
MultiBlocProvider
Merges multiple BlocProvider widgets into one widget tree. [...]
MultiRepositoryProvider
Merges multiple RepositoryProvider widgets into one widget tree. [...]
PageFetcher
This class perform fetch with standard limit pagination You can use this class in ListValueCubit when you are interested in using paging queries with same limit
PaginatedTableListValueCubitBuilder<C extends ListValueCubit<V, Filter>, V, Filter>
Build a PaginatedDataTable with ListValueCubit
RefreshConfiguration
Controls how SmartRefresher widgets behave in a subtree.the usage just like ScrollConfiguration [...]
RefresherValueCubitBuilder
This is the most important component that provides drop-down refresh and up loading. It implement a ptr.SmartRefresher class with ValueCubit state logic management
RefresherValueCubitPlugin<C extends ValueCubit<S, Filter>, S extends ValueState<Filter>, Filter>
This is a plugin used in ViewValueCubitBuilderBase and it integrate a RefresherValueCubitBuilder
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. [...]
SingleValueCubit<V, Filter extends Object>
SingleValueState<V, Filter>
SingleViewValueCubitBuilder<C extends SingleValueCubit<V, Filter>, V, Filter>
it is a ViewValueCubitBuilderBase for SingleValueCubit
SuccessLoadedSingleValueState<V, Filter>
Transition<Event, State>
Occurs when an event is added after mapEventToState has been called but before the bloc's State has been updated. A Transition consists of the currentState, the event which was added, and the nextState.
ValueCubit<S extends ValueState<Filter>, Filter>
if loadingStatus is loading automatic start loading if fetchStatus is fetching automatic start fetching
ValueFetcher
This class permit a custom fetching for ListValueCubit
ValueState<Filter>
ValueViewData
It defines default ViewErrorBuilder, ViewLoaderBuilder, ViewEmptyBuilder
ValueViewDataProvider
It provider in SingleViewValueCubitBuilder or ListViewValueCubitBuilder the defaults builders
ViewBuilder
This is a view builder with default ViewErrorBuilder, ViewLoaderBuilder, ViewEmptyBuilder
ViewData
It defines default ViewErrorBuilder, ViewLoaderBuilder, ViewEmptyBuilder
ViewDataProvider
It provider in ViewBuilder, SingleViewValueCubitBuilder or ListViewValueCubitBuilder the defaults builders
ViewValueCubitBuilderBase<C extends ValueCubit<S, dynamic>, S extends ValueState>
Prefer use SingleViewValueCubitBuilder or ListViewValueCubitBuilder [...]
ViewValueCubitPlugin<C extends ValueCubit<S, Filter>, S extends ValueState<Filter>, Filter>
This is a plugin for wrapping a child in ViewValueCubitBuilderBase

Mixins

FailedListValueState<V, Filter>
FailedSingleValueState<V, Filter>
FailedValueState<Filter>
FetchedValueState<Filter>
FetchFailedValueState<Filter>
FetchingValueState<Filter>
IdleValueState<Filter>
LoadedValueState<Filter>
LoadFailedValueState<Filter>
LoadingValueState<Filter>
ProcessingListValueState<V, Filter>
ProcessingSingleValueState<V, Filter>
ProcessingValueState<Filter>

Extensions

BlocProviderExtension
Extends the BuildContext class with the ability to perform a lookup based on a Bloc type.
ReadContext
Exposes the read method.
RepositoryProviderExtension
Extends the BuildContext class with the ability to perform a lookup based on a repository type.
SelectContext
Adds a select method on BuildContext.
WatchContext
Exposes the watch method.

Typedefs

BlocBuilderCondition<S>(S previous, S current) → bool
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>(S previous, S current) → bool
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>(BuildContext context, S state) → Widget
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>(BuildContext context, S state) → void
Signature for the listener function which takes the BuildContext along with the state and is responsible for executing in response to state changes.
TransitionFunction<Event, State>(Event) → Stream<Transition<Event, State>>
Signature for a mapper function which takes an Event as input and outputs a Stream of Transition objects.
ValueViewEmptyBuilder(BuildContext context) → Widget
It build a widget for showing a empty list or empty screen Center(child: Text('Empty'))
ValueViewErrorBuilder(BuildContext context, Object error) → Widget
It build a widget for showing a error Ex. Center(child: Text('$error'))
ValueViewLoaderBuilder(BuildContext context, double progress) → Widget
It build a widget for showing a progress Ex. Center(child: CircularProgressIndicator(value: progress))
ViewEmptyBuilder(BuildContext context) → Widget
It build a widget for showing a empty list or empty screen Center(child: Text('Empty'))
ViewErrorBuilder(BuildContext context, Object error) → Widget
It build a widget for showing a error Ex. Center(child: Text('$error'))
ViewLoaderBuilder(BuildContext context, double progress) → Widget
It build a widget for showing a progress Ex. Center(child: CircularProgressIndicator(value: progress))

Exceptions / Errors

CubitUnhandledErrorException
Exception thrown when an unhandled error occurs within a Cubit. [...]