pendulum 0.1.3+1 copy "pendulum: ^0.1.3+1" to clipboard
pendulum: ^0.1.3+1 copied to clipboard

discontinued

A dynamic, Stream-based API for job scheduling in Dart, capable of processing on different triggers.

example/pendulum_example.dart

import 'package:pendulum/pendulum.dart';

void main() async {
  var task = Task<String>((List args) {
    return 'Simple process!';
  }, []);
  var task2 = Task<String>((List args) {
    return 'Delayed process!';
  }, []);
  var task3 = Task<String>((List args) {
    return 'Repeated process!';
  }, []);
  var watch = Stopwatch();

  // Simple process and listen.
  task.process().listen((var data) {
    print(data);
  });

  // Process after a delay of 5 seconds.
  watch.start();
  task2.processAfter(Duration(seconds: 5)).listen((var data) {
    print(data);
    watch.stop();
    print(watch.elapsedMilliseconds);
  });

  await Future.delayed(Duration(seconds: 10));

  // Repeatedly process every 5 seconds for 20 seconds.
  watch.reset();
  watch.start();
  task3
      .repeatIntervalFor(Duration(seconds: 20), Duration(seconds: 5))
      .listen((var data) {
    print(data);
    print(watch.elapsedMilliseconds);
  });
}
8
likes
25
pub points
26%
popularity

Publisher

verified publisherkishoredev.live

A dynamic, Stream-based API for job scheduling in Dart, capable of processing on different triggers.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

path

More

Packages that depend on pendulum