withLoading method

Future<T> withLoading(
  1. BuildContext context, [
  2. String? message
])

withLoading.

Implementation

Future<T> withLoading(BuildContext context, [String? message]) {
  if (!context.mounted) return this;

  /// show.
  LoadingHelper.show(context, message);
  return whenComplete(() {
    /// hide.
    LoadingHelper.hide();
  });
}