Notify class

Notification facade.

Static API for sending and managing notifications.

Usage:

// Send notification
await Notify.send(user, MonitorDownNotification(monitor));

// Listen to notifications
Notify.notifications().listen((notifications) {
  print('Unread: ${notifications.where((n) => !n.isRead).length}');
});

// Mark as read
await Notify.markAsRead(notificationId);

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

isPolling → bool
Whether the periodic poller is currently armed.
no setter
isRealtime → bool
Whether notification state is currently arriving over a socket.
no setter
manager → NotificationManager
Get the notification manager instance.
no setter
pushState → PushStateReporter
Reports whether a push can reach this device to the app's backend, and releases the device on sign-out.
no setter
view → NotificationViewRegistry
The notification view registry.
no setter

Static Methods

deleteNotification(String id) → Future<void>
Delete notification.
describePushUserUsing(PushUserAttributesResolver? describe) → void
Registers how this app describes whoever signs in, once, for every later login and account switch.
extend(String name, PushDriver factory()) → void
Registers factory as the push driver named name. See NotificationManager.extend.
fetchNotifications() → Future<void>
Fetch notifications from backend.
fetchPaginatedNotifications({int page = 1, int perPage = 15}) → Future<PaginatedNotifications>
Fetch paginated notifications from backend.
forgetDrivers() → void
Drops every channel, every registered driver and every resolved instance. See NotificationManager.forgetDrivers.
forgetView() → void
Drops the view registry so the next read of view seeds a fresh one.
initializePush(String userId) → Future<void>
Initialize push notifications.
logoutPush() → Future<void>
Logout from push notifications.
markAllAsRead() → Future<void>
Mark all notifications as read.
markAsRead(String id) → Future<void>
Mark notification as read.
notifications() → Stream<List<DatabaseNotification>>
Get stream of database notifications.
openPushSettings() → Future<void>
Open this app's notification settings page on a device that denied push.
pausePolling() → void
Pause polling temporarily.
refreshNotifications() → Future<void>
Alias for fetchNotifications() for convenience.
requestPushPermission() → Future<bool>
Request push notification permission.
resumePolling() → void
Resume polling after pause.
send(Notifiable notifiable, Notification notification) → Future<void>
Send a notification to a notifiable entity.
startPolling() → void
Start polling for new notifications.
startRealtime({String? channel, String event = NotificationManager.realtimeEvent}) → Future<bool>
Receive notification state over the app's broadcast socket instead of polling for it.
stopPolling() → void
Stop polling for notifications.
stopRealtime() → void
Stop receiving notification state over the socket.
unreadCount() → Future<int>
Get unread notification count.