withMessaging method

Builder withMessaging([
  1. bool enableMessaging = true,
  2. MessagingListener? listener
])

Sets automatic integration for push notification for iOS. Register Messaging listener for optional callback on Push events for both iOS and Android.

This API takes care of all the setup for iOS push Notifications.

  1. Registers for Notifications.
  2. Handles device token.
  3. Listens for callbacks from UIApplication and UNUserNotificationCenter.

Implementation

Builder withMessaging(
    [bool enableMessaging = true, MessagingListener? listener]) {
  if (!enableMessaging) {
    return this;
  }

  if (messagingAgent != null) {
    if (listener != null) {
      messagingAgent!.setListener(listener);
    }

    messagingAgent!.withMessaging();
  }
  return this;
}