schedulers 1.0.1 copy "schedulers: ^1.0.1" to clipboard
schedulers: ^1.0.1 copied to clipboard

Dart library for running asynchronous functions on time. Useful for load balancing, rate limiting, lazy execution.

example/example.dart

import 'package:schedulers/schedulers.dart';

Future<void> download(String url) async {
  // relax, this is an example
}

void main() {
  final scheduler = RateScheduler(3, Duration(seconds: 1)); // 3 per second

  // the following tasks are executed immediately
  scheduler.run(() => download('pageA'));
  scheduler.run(() => download('pageB'));
  scheduler.run(() => download('pageC'));

  // the following tasks are executed one second later
  scheduler.run(() => download('pageD'));
  scheduler.run(() => download('pageE'));
  scheduler.run(() => download('pageF'));

  // the following tasks are executed two seconds later
  scheduler.run(() => download('pageG'));
  scheduler.run(() => download('pageH'));
  scheduler.run(() => download('pageI'));
}
32
likes
160
points
6.19k
downloads

Publisher

verified publisherrevercode.com

Weekly Downloads

Dart library for running asynchronous functions on time. Useful for load balancing, rate limiting, lazy execution.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

collection, meta

More

Packages that depend on schedulers