bloc library

Classes

BaseBlocDelegate<E extends MainBlocEvent, S extends MainBlocState>
BasePageState<T extends StatefulWidget, B extends MainBloc<MainBlocEvent, MainBlocState>>
A base class for all StatefulWidget states in the application that use a Bloc.
BasePageStateDelegate<T extends StatefulWidget, B extends MainBloc<MainBlocEvent, MainBlocState>>
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 StateStreamable<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...
BlocConsumer<B extends StateStreamable<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 StateStreamable<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.
BlocProvider<T extends StateStreamableSource<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 StateStreamable<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.
CommonBloc
CommonEvent
CommonState
Cubit<State>
A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
Emitter<State>
An Emitter is a class which is capable of emitting new states.
GetIt
Very simple and easy to use service locator You register your object creation factory or an instance of an object with registerFactory, registerSingleton or registerLazySingleton And retrieve the desired object using get or call your locator as function as its a callable class Additionally GetIt offers asynchronous creation functions as well as functions to synchronize the async initialization of multiple Singletons
LoadingIndicator
MainBloc<E extends MainBlocEvent, S extends MainBlocState>
A base class for all Blocs in the application.
MainBlocEvent
A base class for all Bloc events in the application.
MainBlocState
A base class for all Bloc states in the application.
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.
ReactiveSubject<T>
A wrapper class for RxDart subjects that provides a simplified interface for reactive programming.
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.
SetComponentLoading
Transition<Event, State>
A Transition is the change from one state to another. Consists of the currentState, an event, and the nextState.

Extensions

ReadContext on BuildContext
Exposes the read method.
SelectContext on BuildContext
Adds a select method on BuildContext.
WatchContext on BuildContext
Exposes the watch method.

Properties

getIt GetIt
final

Functions

configureInjection() → void