startLoop method

void startLoop(
  1. String id,
  2. Future<void> body(), {
  3. Duration? delay,
  4. bool permanent = false,
})

Starts a sequential loop with the given id and body.

The body is executed repeatedly. The next iteration starts after the previous one completes and delay has passed.

Implementation

void startLoop(
  String id,
  Future<void> Function() body, {
  Duration? delay,
  bool permanent = false,
}) {
  final service = _LoopService(body, delay: delay);
  registerService(id, service, permanent: permanent);
  service.start();
}