findNext method

  1. @override
DateTime findNext(
  1. DateTime? execution
)
override

Implementation

@override
DateTime findNext(DateTime? execution) {
  if (execution != null) {
    return execution.add(const Duration(days: 1));
  } else {
    final now = DateTime.now();
    final today =
        DateTime(now.year, now.month, now.day, hour, minute, second);
    if (today.isAfter(now)) {
      return today;
    } else {
      return today.add(const Duration(days: 1));
    }
  }
}