scheduleNext method
id (IDEA-62) lets a caller manage more than one independent
reminder slot — left at its default (0), this is the exact same
single-reminder call every existing call site already makes. A
second call with a DIFFERENT id schedules an entirely separate
notification rather than replacing the first (the platform plugin
keys purely on id); a second call with the SAME id replaces
whatever that slot previously had scheduled, same as before this
param existed. See utils/smart_reminder_scheduling.dart for a
worked example (energy-full/streak-expiring reminders, each in
their own slot).
Implementation
Future<void> scheduleNext({
Duration delay = const Duration(hours: 24),
String title = 'Roy Project Base Game',
String body = 'Come back and play!',
int id = 0,
}) async {
try {
await _ensureInit();
await _plugin.zonedSchedule(
id: id,
title: title,
body: body,
scheduledDate: tz.TZDateTime.now(tz.local).add(delay),
notificationDetails: const NotificationDetails(
android: AndroidNotificationDetails('reminders', 'Reminders'),
iOS: DarwinNotificationDetails(),
),
androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle,
);
} catch (e) {
dlog('ReminderService.scheduleNext failed: $e');
}
}