NotificationService class abstract

Constructors

NotificationService()

Properties

atSign → Atsign
Our atSign
no setter
currentListenerState → NotificationListenerState
Whether the service is currently listening for notifications. If network connectivity is lost or weird, the listener will detect that, and will disconnect and periodically try to reconnect until successful, or until stopListening has been called.
no setter
currentListenerStateStream → Stream<NotificationListenerState>
Get an event every time the currentListenerState is set. NB The listener state can be set to the same value it was previously. This happens for example for every time the listener attempts to reconnect to the atServer while the network is unavailable.
no setter
droppedEvents → Stream<DroppedNotification>
Every notification this service gives up on without delivering it, such as one this client cannot decrypt, with the reason it logs at warning.
no setter
hashCode → int
The hash code for this object.
no setterinherited
lastReceipt → DateTime?
The time at which a notification was last received. null if nothing has yet been received.
no setter
listening → bool
Same as currentListenerState == NotificationListenerState.listening as a convenience for application code
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
targetListenerState → NotificationListenerState
Whether the service should be currently listening for notifications.
no setter

Methods

fetch(String notificationId) → Future<AtNotification>
Returns the AtNotification of the given notificationId
getStatus(String notificationId) → Future<NotificationResult>
Returns the status of the given notificationId
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify(NotificationParams notificationParams, {bool waitForFinalDeliveryStatus = true, bool checkForFinalDeliveryStatus = true, bool encryptValue = true, dynamic onSuccess(NotificationResult)?, dynamic onError(NotificationResult)?, dynamic onSentToSecondary(NotificationResult)?}) → Future<NotificationResult>
Sends notification to notificationParams.atKey.sharedWith atSign.
send({required Atsign to, required String idAndNamespace, String body = '', bool shouldEncrypt = true, String? cryptoProviderId, String? sealToNamespace, Duration expiration = NotificationService.defaultExpiration, bool cacheAtRecipient = false, DateTime? recipientCacheExpiration, bool ephemeral = false}) → Future<String>
Send a notification to to named idAndNamespace, with body (payload) body. Will encrypt body before sending if shouldEncrypt is true (default).
startListening() → void
Explicitly start the notification listener. If the notification listener is already started, this should do nothing. Sets targetListenerState to NotificationListenerState.listening
stopAllSubscriptions({bool stopNotificationsListener = true}) → void
Stops all subscriptions on the current instance. By default will also stop listening for notifications from the atServer. If you wish to stop listening for notifications for some reason, but keep the subscriptions, then you should call startListening.
stopListening() → void
Stop the notification listener. If the notification listener is already stopped, this should do nothing. Sets targetListenerState to NotificationListenerState.notConnected
subscribe({String? regex, bool shouldDecrypt}) → Stream<AtNotification>
Gives back stream of notifications from the server to the subscribing client.
subscribeFiltered({Set<Atsign>? acceptedSenders, required String namespace}) → Stream<AtNotification>
calls subscribe with regex constructed from the namespace
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

defaultExpiration → const Duration