BrazePlugin constructor

BrazePlugin({
  1. dynamic inAppMessageHandler(
    1. BrazeInAppMessage
    )?,
  2. dynamic brazeSdkAuthenticationErrorHandler(
    1. BrazeSdkAuthenticationError
    )?,
  3. dynamic contentCardsHandler(
    1. List<BrazeContentCard>
    )?,
  4. dynamic featureFlagsHandler(
    1. List<BrazeFeatureFlag>
    )?,
  5. dynamic pushEventHandler(
    1. BrazePushEvent
    )?,
  6. Map<String, bool>? customConfigs,
})

The plugin used to interface with all Braze APIs with optional parameters specific customization.

Each of the different handlers can subscribe to their respective streams at plugin initialization. These can also be subscribed at a later time after initialization

Implementation

BrazePlugin(
    {Function(BrazeInAppMessage)? inAppMessageHandler,
    Function(BrazeSdkAuthenticationError)? brazeSdkAuthenticationErrorHandler,
    Function(List<BrazeContentCard>)? contentCardsHandler,
    Function(List<BrazeFeatureFlag>)? featureFlagsHandler,
    Function(BrazePushEvent)? pushEventHandler,
    Map<String, bool>? customConfigs}) {
  _brazeCustomConfigs = customConfigs;
  _brazeSdkAuthenticationErrorHandler = brazeSdkAuthenticationErrorHandler;

  if (inAppMessageHandler != null) {
    subscribeToInAppMessages(inAppMessageHandler);
  }
  if (contentCardsHandler != null) {
    subscribeToContentCards(contentCardsHandler);
  }
  if (featureFlagsHandler != null) {
    subscribeToFeatureFlags(featureFlagsHandler);
  }
  if (pushEventHandler != null) {
    subscribeToPushNotificationEvents(pushEventHandler);
  }

  // Called after setting up plugin settings
  _channel.setMethodCallHandler(_handleBrazeData);
}