FourStateConsumer<B extends BlocBase<FourStates<T>>, T> constructor

FourStateConsumer<B extends BlocBase<FourStates<T>>, T>({
  1. required SuccessBuilder<T> succeedBuilder,
  2. InitialBuilder? initialBuilder,
  3. LoadingBuilder? loadingBuilder,
  4. FailureBuilder? failureBuilder,
  5. SuccessListener<T>? succeedListener,
  6. InitialListener? initialListener,
  7. LoadingListener? loadingListener,
  8. FailureListener? failureListener,
  9. B? bloc,
  10. BlocListenerCondition<FourStates<T>>? listenWhen,
  11. BlocBuilderCondition<FourStates<T>>? buildWhen,
  12. Key? key,
})

Implementation

FourStateConsumer({
  required SuccessBuilder<T> succeedBuilder,
  InitialBuilder? initialBuilder,
  LoadingBuilder? loadingBuilder,
  FailureBuilder? failureBuilder,
  SuccessListener<T>? succeedListener,
  InitialListener? initialListener,
  LoadingListener? loadingListener,
  FailureListener? failureListener,
  B? bloc,
  BlocListenerCondition<FourStates<T>>? listenWhen,
  BlocBuilderCondition<FourStates<T>>? buildWhen,
  super.key,
}) : super(
        bloc: bloc,
        listenWhen: listenWhen,
        listener: (context, state) => state.mayBeMap(
          orElse: () => null,
          initialState: initialListener,
          loadingState: loadingListener,
          succeedState: succeedListener,
          failedState: failureListener,
        ),
        buildWhen: buildWhen,
        builder: (context, state) => state.map(
          initialState: initialBuilder ??
              BlocEaseStateWidgetsProvider.of(context).initialStateBuilder,
          loadingState: loadingBuilder ??
              BlocEaseStateWidgetsProvider.of(context).loadingStateBuilder,
          failedState: failureBuilder ??
              BlocEaseStateWidgetsProvider.of(context).failureStateBuilder,
          succeedState: succeedBuilder,
        ),
      );