onStart method

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

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

Implementation

@override
Future<bool> onStart() async {
  if (configuration!.schedule.isAfter(DateTime.now())) {
    warning('The schedule of the DateTimeTrigger cannot be in the past.');
    return false;
  } else {
    var delay = configuration!.schedule.difference(DateTime.now());
    timer = Timer(delay, () => onTrigger());
  }
  return true;
}