getNextDate method

  1. @override
Future<DateTime?> getNextDate(
  1. NotificationSchedule schedule, {
  2. DateTime? fixedDate,
})
override

Get the next valid date for a notification schedule

Implementation

@override
Future<DateTime?> getNextDate(NotificationSchedule schedule,
    {DateTime? fixedDate}) async {
  fixedDate ??= DateTime.now().toUtc();
  Map parameters = {
    NOTIFICATION_INITIAL_FIXED_DATE:
        LocalDateUtils.parseDateToString(fixedDate),
    NOTIFICATION_SCHEDULE: schedule.toMap()
  };

  final String? nextDate = await methodChannel.invokeMethod(
      CHANNEL_METHOD_GET_NEXT_DATE, parameters);

  if (nextDate == null) return null;

  return LocalDateUtils.parseStringToDate(nextDate)!;
}