Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.
/ progress.dart Public archive

Compute progress of a long-running process.

License

Notifications You must be signed in to change notification settings

matanlurey/progress.dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

progress

Compute progress of a long-running process.

pub package Build Status Coverage Status

This package is platform agnostic, and will work equally well for command-line applications (CLI), mobile applications on Flutter, and web applications written in Dart.

Warning: This is not an official Google or Dart project.

Installation

dependencies:
  progress: ^0.1.0

Usage

To produce a Stream<Moment>, use an Updater:

// A simple stub of reporting 50% progress, then 100%.
Stream<Moment> progress() {
  final updater = new Updater(100);
  scheduleMicrotask(() {
    updater.update(50);
    scheduleMicrotask(() {
      updater.update(100);
    });
  });
  return updater;
}

To use an existing Stream<num> of current values, use asProgress:

asProgress(currentValues, totalValue);