withLoading<T> static method

void withLoading<T>(
  1. BuildContext context, {
  2. required Future<T> action(),
  3. required dynamic onSuccess(
    1. T result
    ),
  4. dynamic onError(
    1. Object error
    )?,
  5. dynamic onComplete()?,
  6. String? errorMessage,
})

Implementation

static void withLoading<T>(
  BuildContext context, {
  required Future<T> Function() action,
  required Function(T result) onSuccess,
  Function(Object error)? onError,
  Function()? onComplete,
  String? errorMessage,
}) {
  execute(
    context: context,
    action: action,
    onSuccess: onSuccess,
    onError: onError,
    onComplete: onComplete,
    errorMessage: errorMessage,
  );
}