juice_notifications library
Local notification delivery and tap routing as a Juice bloc.
NotificationsBloc owns local notification scheduling/display and the
last-tapped payload, through a swappable NotificationService seam (default
LocalNotificationService). Permission status is set externally via
NotificationsBloc.setPermissionStatus — wire it from juice_permissions
with a PermissionBinding.
final notifications = NotificationsBloc.withConfig(NotificationsConfig());
notifications.show(JuiceNotification(id: 1, title: 'Hi', body: 'There'));
// Wire permission status from juice_permissions:
PermissionBinding(permissions, JuicePermission.notification,
onStatus: (s) => notifications.setPermissionStatus(s == PermissionStatus.granted),
)..start();
Push notifications (FCM/APNs) are out of scope for now — a separate
PushNotificationSource seam is planned.
Classes
- CancelAllNotificationsEvent
- Cancel all notifications.
- CancelNotificationEvent
- Cancel one notification by id.
- InitializeNotificationsEvent
- Configure the service, start listening for taps.
- JuiceNotification
- A notification to post — immediately (NotificationsBloc.show) or at a time (NotificationsBloc.schedule).
- LocalNotificationService
-
Default NotificationService backed by
flutter_local_notifications. - NotificationsBloc
- Bloc that owns local notification delivery and tap routing.
- NotificationsConfig
- Configuration for NotificationsBloc.
- NotificationService
- Vendor seam for delivering local notifications.
- NotificationsEvent
- Base class for notification events.
- NotificationsGroups
- Rebuild groups emitted by NotificationsBloc.
- NotificationsState
- Immutable notifications state.
- NotificationTap
- A tapped notification, surfaced for the app to route on.
- NotificationTappedEvent
- Internal: a notification was tapped (from the service stream).
- ScheduleNotificationEvent
- Post a notification at when.
- SetPermissionStatusEvent
-
Set whether the app may post notifications (wire from
juice_permissions). - ShowNotificationEvent
- Post a notification now.