Does Dart have a planner?

I look at the dart in terms of server side.

Is there a scheduler that can perform isolation at a specific time or X times per hour? I think of quartz lines in the Java world.

+5
source share
1 answer

There are several options for deferred and repetitive tasks in Dart, but I don’t know about the Quartz port for Dart (more ... :)

Here is the basic information:

  • Timer - just run the function after some delay
  • Future - More robust, compound functions that return "future" values
  • Stream- reliable, composite streams of events. May be periodic.

, Stream over Timer. , (Dart ).

Stream :

import 'dart:async';

main() {
  var stream = new Stream.periodic(const Duration(hours: 1), (count) {
    // do something every hour
    // return the result of that something
  });

  stream.listen((result) {
    // listen for the result of the hourly task
  });
}

. . , .

+10

All Articles