async_track 0.2.0 copy "async_track: ^0.2.0" to clipboard
async_track: ^0.2.0 copied to clipboard

Dart 1 only

Track asynchronous events in Dart.

async_track #

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.

Usage #

You can use track asynchronous events once or continuously.

runTracked #

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.
  doTask1();
  doTask2();
  doTask3();
});

AsyncTracker #

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.

0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Track asynchronous events in Dart.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

meta, stack_trace

More

Packages that depend on async_track