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'));
}
27
likes
140
pub points
88%
popularity

Publisher

verified publisherrevercode.com

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

collection, meta

More

Packages that depend on schedulers