async_track 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 0

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.

Changelog

0.2.0

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

0.1.0

  • Initial commit

Use this package as a library

1. Depend on it

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


dependencies:
  async_track: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub 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
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Health issues and suggestions

Fix lib/async_track.dart. (-68.36 points)

Analysis of lib/async_track.dart failed with 4 errors:

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'.

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

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

line 383 col 7: Missing concrete implementation of getter Timer.tick.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Fix platform conflicts. (-20 points)

Low code quality prevents platform classification.

Package is too old. (-100 points)

The package was released more than two years ago.

The description is too short. (-20 points)

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

Maintain an example. (-10 points)

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
meta >=1.0.4 <2.0.0 1.1.6
stack_trace >=1.7.0 <2.0.0 1.9.3
Transitive dependencies
path 1.6.2
Dev dependencies
dart_style any
test any