progress_future 0.1.0 copy "progress_future: ^0.1.0" to clipboard
progress_future: ^0.1.0 copied to clipboard

A Future that reports the progress of its completion, and various progress bars to show it in CLI.

example/main.dart

import 'package:progress_future/progress_future.dart';

Future<void> main() async {
  // Integer progress:
  final future = wait(5);

  future.events.listen((event) {
    print('${event.progress} seconds elapsed.');
  });

  print(await future);
}

IntProgressFuture<String> wait(int seconds) {
  final updater = IntProgressUpdater(total: seconds);

  Future<String> generate(int seconds) async {
    for (int n = 0; n < seconds; n++) {
      updater.setProgress(n);
      await Future.delayed(const Duration(seconds: 1));
    }

    return 'Waited $seconds seconds.';
  }

  return IntProgressFuture.wrap(generate(seconds), updater);
}
1
likes
160
points
53
downloads

Publisher

verified publisherainkin.com

Weekly Downloads

A Future that reports the progress of its completion, and various progress bars to show it in CLI.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT-0 (license)

Dependencies

async, clock

More

Packages that depend on progress_future