ToastrFutureExtension<T> extension

Promise-style toast helpers for any Future.

The original future's result and error behavior are preserved.

final profile = api.saveProfile().withToastr(
  loading: 'Saving profile...',
  success: 'Profile saved',
  error: 'Could not save profile',
);
on

Methods

withToastr({String loading = 'Loading...', String success = 'Success!', String error = 'Something went wrong', String successBuilder(T data)?, String errorBuilder(Object error)?, ToastrPosition? position, Duration? successDuration, Duration? errorDuration}) Future<T>

Available on Future<T>, provided by the ToastrFutureExtension extension

Shows a loading toast and transitions it to success or error when this future completes.