subscribeToPushNotificationEvents method

StreamSubscription subscribeToPushNotificationEvents(
  1. void onEvent(
    1. BrazePushEvent
    )
)

Implementation

StreamSubscription subscribeToPushNotificationEvents(
    void Function(BrazePushEvent) onEvent) {
  if (_replayCallbacksConfigEnabled() && _queuedPushEvents.isNotEmpty) {
    print(
        "Replaying stream onEvent for previously queued Braze push events.");
    _queuedPushEvents.forEach((pushEvent) => onEvent(pushEvent));
    _queuedPushEvents.clear();
  }

  StreamSubscription subscription =
      pushEventStreamController.stream.listen(onEvent);
  return subscription;
}