useBlocState<S> function

S useBlocState<S>(
  1. BlocBase<S> bloc
)

Provides Cubit's or Bloc's current state. Forces HookWidget to rebuild on state change.

Implementation

S useBlocState<S>(BlocBase<S> bloc) {
  return useStream(
    bloc.stream,
    initialData: bloc.state,
    preserveState: false,
  ).data as S;
}