hooked_bloc library

Classes

ActionBloc<STATE, EVENT, ACTION>
Syntactic sugar for Bloc with BlocActionMixin
ActionCubit<STATE, ACTION>
Syntactic sugar for Cubit with BlocActionMixin
BlocFactory<T extends BlocBase>
BuildState
HookedBlocConfigProvider
HookedBlocConfigProvider provides you a way to setup widget tree scoped HookedBlocConfig for cubit hooks

Mixins

BlocActionMixin<ACTION, S>
General purpose mixin on BlocBase. Provides new method BlocActionMixin.dispatch, to emit new action event.

Functions

useActionListener<ACTION>(BlocActionMixin<ACTION, Object> actionMixin, OnActionCallback<ACTION> onAction, {ActionListenerCondition<ACTION>? actionWhen}) → void
Calls callback function onAction each time, when new action is dispatched from BlocBase with BlocActionMixin, ActionCubit or ActionBloc
useBloc<T extends BlocBase>({List keys = const <dynamic>[], bool closeOnDispose = true}) → T
Provides BlocBase
useBlocBuilder<C extends BlocBase, S>(BlocBase<S> bloc, {BlocBuilderCondition<S>? buildWhen}) → S
Returns current state of BlocBase class
useBlocComparativeBuilder<C extends BlocBase, S>(BlocBase<S> bloc, {required BlocComparativeBuilderCondition<S> buildWhen}) → S
Returns current state of BlocBase class basing on state's comparison
useBlocComparativeListener<BLOC extends BlocBase<S>, S>(BLOC bloc, BlocComparativeListener<BLOC, S> listener, {required BlocComparativeListenerCondition<S> listenWhen}) → void
useBlocFactory<T extends BlocBase, F extends BlocFactory<T>>({OnBlocCreated<F>? onBlocCreate, List keys = const <dynamic>[], bool closeOnDispose = true}) → T
Creates BlocBase
useBlocListener<BLOC extends BlocBase<S>, S>(BLOC bloc, BlocListener<BLOC, S> listener, {BlocListenerCondition<S>? listenWhen}) → void
Calls callback function listener each time when listenWhen conditions are fulfilled

Typedefs

ActionListenerCondition<T> = bool Function(T? previousAction, T action)
BlocBuilderCondition<S> = bool Function(S current)
BlocComparativeBuilderCondition<S> = bool Function(S previous, S current)
BlocComparativeListener<BLOC extends BlocBase<S>, S> = void Function(BLOC bloc, S current, BuildContext context)
BlocComparativeListenerCondition<S> = bool Function(S previous, S current)
BlocListener<BLOC extends BlocBase<S>, S> = void Function(BLOC bloc, S current, BuildContext context)
BlocListenerCondition<S> = bool Function(S current)
OnActionCallback<T> = dynamic Function(T action)
OnBlocCreated<F extends BlocFactory<BlocBase>> = dynamic Function(F factory)