You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dartnative_notifications: list pending notifications, schedule at a date, and read the permission status #120
I searched the existing feature requests and this is not a duplicate.
Framework or plugin?
Plugin
Platform
Both
Use case
dartnative_notifications 1.0.4 (bundled with 1.10.0) offers setup, getInitialTapPayload, requestPermission, show({id, title, body, payload, delaySeconds}), showChat, cancel, cancelAll and onTap (lib/src/dartnative_notifications.dart). Three things a reminder feature needs are missing:
No way to list pending notifications. After scheduling show(id: 'n1', …) the app can't ask the OS whether n1 is still pending. We checked the simulator's own pending store to confirm scheduling and cancel work, but nothing in the API reads it.
Scheduling is by delay only.show takes delaySeconds, so a reminder for 9:05 PM becomes target.difference(DateTime.now()).inSeconds. It fires after that many seconds of device time, so if the user changes the clock (or travels across zones) it fires at the wrong wall-clock time.
No permission status read.requestPermission() returns the answer to the prompt, but there's no read of the current setting. If the user turns alerts back on in Settings, the app can't tell until it asks again.
We use it for "leave now" reminders before a night out. Our workaround is an app-side ledger (id → time, plus the last permission answer) in shared preferences, re-scheduled whenever the app opens. It can disagree with the OS: the app shows "Reminders are off" after the user re-enabled them in Settings, until the next save.
Proposal
Add three calls, mirroring flutter_local_notifications:
// iOS: UNUserNotificationCenter.getPendingNotificationRequests; Android: the plugin's own record of scheduled alarmsstaticFuture<List<PendingNotification>> pending(); // {id, title, body, payload, fireAt?}// iOS: UNCalendarNotificationTrigger; Android: an exact alarm at that timestaticvoidshow({requiredString id, requiredString title, String body ='',
String payload ='', int delaySeconds =0, DateTime? at});
// UNUserNotificationCenter.getNotificationSettings / NotificationManagerCompat.areNotificationsEnabledstaticFuture<NotificationPermission> permissionStatus(); // granted, denied, notDetermined, provisional
Activity