addListener method

void addListener(
  1. NotificationMessage_NotificationType type,
  2. void listener(
    1. NotificationMessage
    )
)

Adds a listener for a specific notification type.

type specifies the type of notification to listen for. listener is the callback function to be executed when the notification is received.

Implementation

void addListener(NotificationMessage_NotificationType type, void Function(NotificationMessage) listener) {
  _listeners.putIfAbsent(type, () => []).add(listener);
}