start method

FinchCron 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 FinchCron for chaining.

Implementation

FinchCron start() {
  _status = CronStatus.running;

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

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

  return this;
}