executor 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 78

Async task executor for Dart

Executes async tasks with a configurable maximum concurrency and rate.

Usage

A simple usage example:

import 'dart:async';

import 'package:executor/executor.dart';

Future main() async {
  Executor executor = new Executor(concurrency: 10);
  // only 10 of them will be running at a time
  for (int i = 0; i < 20; i++) {
     executor.scheduleTask(() async {
       // await longDatabaseTask()
       // await anotherProcessing()
     });
  }
}

Changelog

1.0.0

Breaking changes

  • Removed deprecated member limit.
  • Renamed ExecutorTask -> AsyncTask, return value to FutureOr.
  • Renamed Rate.limit -> Rate.maximum.

New features

  • Added Executor.onChange. Clients can use this to monitor the current scheduledCount and queue more tasks to ensure Executor is running on full capacity.

Housekeeping

  • Added example.
  • Added a few tests.

0.1.2

  • Expose internal stats: runningCount, waitingCount, scheduledCount.
  • Enable sync-points with join(), which allows to track the completion of the currently running (and optionally the waiting) tasks.

0.1.1

  • Fix missing heartbeat check on Executor.close(), without it the Future might not have completed.

0.1

  • start-rate limit support
  • renamed limit to concurrency (leaving old field, marked deprecated)

example/example.dart

// Copyright (c) 2017, Agilord. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:executor/executor.dart';

Future main() async {
  Executor executor = new Executor(concurrency: 10);
  // only 10 of them will be running at a time
  for (int i = 0; i < 20; i++) {
    executor.scheduleTask(() async {
      // await longDatabaseTask()
      // await anotherProcessing()
    });
  }
}

1. Depend on it

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


dependencies:
  executor: "^1.0.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:executor/executor.dart';
        
Version Uploaded Documentation Archive
1.0.0 Sep 19, 2017 Go to the documentation of executor 1.0.0 Download executor 1.0.0 archive
0.1.2 May 3, 2017 Go to the documentation of executor 0.1.2 Download executor 0.1.2 archive
0.1.1 May 3, 2017 Go to the documentation of executor 0.1.1 Download executor 0.1.1 archive
0.1.0 Mar 30, 2017 Go to the documentation of executor 0.1.0 Download executor 0.1.0 archive
0.0.4 Jan 1, 2017 Go to the documentation of executor 0.0.4 Download executor 0.0.4 archive
0.0.3 Dec 29, 2016 Go to the documentation of executor 0.0.3 Download executor 0.0.3 archive
0.0.2 Dec 28, 2016 Go to the documentation of executor 0.0.2 Download executor 0.0.2 archive
0.0.1 Dec 27, 2016 Go to the documentation of executor 0.0.1 Download executor 0.0.1 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
56 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
78
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

    Strong-mode analysis of lib/executor.dart gave the following hint:

    line: 238 col: 47
    'ZERO' is deprecated and shouldn't be used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
Dev dependencies
test ^0.12.24