GgOncePerCycle constructor

GgOncePerCycle({
  1. required void task(),
  2. bool isTest = false,
  3. void scheduleTask(
    1. void task()
    ) = scheduleMicrotask,
})

The task to be triggered only one time in a run loop cycle.

If isTest is true, task will not be executed automatically. In that case call executeNow().

If scheduleTask callback is set, tasks will be scheduled using this function. Otherwise dart's scheduleMicrotask will be used.

Implementation

GgOncePerCycle({
  required this.task,
  this.isTest = false,
  this.scheduleTask = scheduleMicrotask,
});