loaderV2 method
Widget
loaderV2(
- Widget builder(
- BuildContext context,
- T data
- Future<
T> runner()?, - bool when(
- JobCubitState<
T, F> previousState, - JobCubitState<
T, F> currentState
- JobCubitState<
- WidgetBuilder? placeholder,
- bool provide = false,
- bool noRetryAppBar = false,
- void onSuccess(
- T
- VoidCallback? onFailure,
- VoidCallback? onRetry,
- JobErrorBuilder? errorPlaceholder,
- bool isSliver = false,
- bool animateTransitions = true,
Implementation
Widget loaderV2(
Widget Function(BuildContext context, T data) builder, {
Future<T> Function()? runner,
bool Function(JobCubitState<T, F> previousState,
JobCubitState<T, F> currentState)?
when,
WidgetBuilder? placeholder,
bool provide = false,
bool noRetryAppBar = false,
void Function(T)? onSuccess,
VoidCallback? onFailure,
VoidCallback? onRetry,
JobErrorBuilder? errorPlaceholder,
bool isSliver = false,
bool animateTransitions = true,
}) {
return JobCubitLoader<T, F>(
isSliver: isSliver,
animateTransitions: animateTransitions,
builder: (context, state) {
return builder(context, state.builtData.data);
},
fetcher: () => run(runner ??
this.runner ??
() => throw ValueError('Runner is not defined')),
cubit: this,
when: when,
placeholder: placeholder,
provide: provide,
onSuccess: onSuccess,
onFailure: onFailure,
onRetry: onRetry,
noRetryAppBar: noRetryAppBar,
errorPlaceholder: errorPlaceholder,
);
}