start method

WaCron start()

Starts the cron job.

This method changes the cron status to CronStatus.running and schedules the tasks according to the schedule. If delayFirstMoment is false, the first tick runs immediately. Returns the instance of WaCron for chaining.

Implementation

WaCron start() {
  _status = CronStatus.running;

  if (delayFirstMoment == false) {
    _counter++;
    onCron(_counter, this);
  }

  _cron.schedule(Schedule.parse(schedule), () async {
    _counter++;
    onCron(_counter, this);
  });

  return this;
}