Flutter Future Progres Dialog

Show progress dialog with animation while waiting for Future completion and then return the result of that Future.

Flutter
2Stars
0Forks
v1.4.2

Overview

Show progress dialog with animation while waiting for Future completion and then return the result of that Future.

Features

  • Show progress dialog while Future is running
  • Material and Cupertino style dialogs
  • Adaptive dialog that matches platform style
  • Custom dialog builder support
  • Type-safe result handling
  • Error handling with stack traces

Getting started

  • install the library
flutter pub add flutter_future_progress_dialog
  • import the library
import 'package:flutter_future_progress_dialog/flutter_future_progress_dialog.dart';

Usage

A complete working example can be found in the example directory.

The dialog returns a ProgressDialogResult<T> type that can be either:

  • Success<T> containing the successful result value
  • Failure containing the error and stack trace

You can handle both cases using pattern matching:

Here is a short example of showProgressDialog usage.

Call the showProgressDialog inside your function. Pass context and future arguments. Then handle result.

Alternatively you can use showCupertinoProgressDialog to show cupertino-styled dialog and showAdaptiveProgressDialog to show dialog matching host OS.


Future<String> myFuture() async {
  await Future.delayed(const Duration(seconds: 2));
  return 'my string';
}

Future<void> yourFunction(BuildContext context) async {
  final result = await showProgressDialog(
    context: context,
    future: () => myFuture(),
  );
  if (!mounted) {
    return;
  }
  switch (result) {
    case Failure(:final error):
      await showDialog(
        context: context,
        builder: (context) {
          return AlertDialog(
            content: Text(
              '$error',
              textAlign: TextAlign.center,
            ),
            actions: [
              TextButton(
                onPressed: () {
                  Navigator.of(context).pop();
                },
                child: const Text(
                  'OK',
                ),
              ),
            ],
          );
        },
      );
    case Success<String>(:final value):
      // value variable would hold the 'my string' value here
      break;
  }
}

Optionally you can pass a builder to have a custom progress dialog

Future<ProgressDialogResult<LongRunningTaskResult>> buttonCallback({
  required BuildContext context,
}) async {
  return await showProgressDialog(
    future: () => myLongRunningTask(),
    context: context,
    builder: (context) => AlertDialog(
      content: Text('I am loading now'),
    ),
  );
}

Top Contributors

thenixan

thenixan

62 commits
OleksandrFedyay

OleksandrFedyay

33 commits

Repository Info

Technology Stack
Flutter
Version
v1.4.2
License
BSD-3-Clause
Contributors
2
Last Update
Oct 13, 2025, 2:04 PM

Activity

Stars2
Forks0
Watchers2

Want to contribute?

View Repository
Nerdy Production

Building digital solutions that drive success. Transform your ideas into powerful, scalable applications.

Services

  • Custom Software Development
  • Mobile App Development
  • Web Development
  • Performance Optimization
  • Security Audits
  • Team Augmentation

© 2026 Nerdy Production.