async_track 0.2.0

  • Installing
  • Versions
  • 15


Build Status Pub

Provides a mechanism for tracking asynchronous events in Dart.

This package is experimental and subject to change. It currently only has knowledge of microtasks and timers, and ignores other forms of asynchronous events DOM access, network events, file I/O.


You can use track asynchronous events once or continuously.


Future/*<E>*/ runTracked/*<E>*/(/*=E*/ action()) runs action within a Zone, and returns a Future when all asynchronous events started by action (or started by other events) complete.

For example, waiting for some tasks to complete:

await runTracked(() {
  // Any of these could use 'scheduleMicrotask' to schedule work.


For continuous tracking, you can use AsyncTracker, which reports progress of asynchronous events continuously. See async_track.dart.

How it works

Uses the Dart Zone API to create an execution context where a function call and all of it's associated calls and asynchronous tasks are associated with that zone.



  • Added AsyncError object
  • Added onError callback to runTracked
  • Added onError stream to AsyncTracker
  • Added useLongStackTraces as a parameter to new AsyncTracker


  • Initial commit

1. Depend on it

Add this to your package's pubspec.yaml file:

  async_track: "^0.2.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:async_track/async_track.dart';
Version Uploaded Documentation Archive
0.2.0 Nov 16, 2016 Go to the documentation of async_track 0.2.0 Download async_track 0.2.0 archive
0.1.0 Sep 30, 2016 Go to the documentation of async_track 0.1.0 Download async_track 0.1.0 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Feb 14, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
3 / 100
Reflects how tidy and up-to-date the package is. [more]
71 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:async_track/async_track.dart.


  • Fix lib/async_track.dart.

    Strong-mode analysis of lib/async_track.dart failed with the following error:

    line: 276 col: 11
    The argument type '(dynamic, dynamic, dynamic, dynamic) → dynamic' can't be assigned to the parameter type '<R>(Zone, ZoneDelegate, Zone, () → R) → R'.

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 1 error(s) and 0 warning(s).

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use async_track.dart.


Package Constraint Resolved Available
Direct dependencies
meta >=1.0.4 <2.0.0 1.1.2
stack_trace >=1.7.0 <2.0.0 1.9.2
Transitive dependencies
path 1.5.1
Dev dependencies