onResume method

  1. @override
Future<bool> onResume()
override

Callback when this executor is resumed. Returns true if successfully resumed, false otherwise.

Implementation

@override
Future<bool> onResume() async {
  debug('creating cron job : $configuration');
  var schedule = cron.Schedule.parse(configuration!.cronExpression);
  _scheduledTask = _cron.schedule(schedule, () async {
    debug('resuming cron job : ${DateTime.now().toString()}');
    await super.onResume();
    Timer(configuration!.duration, () => super.onPause());
  });
  return true;
}