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. Map<String, bool>? customConfigs,
})

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

The inAppMessageHandler and contentCardsHandler 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,
    Map<String, bool>? customConfigs}) {
  _brazeCustomConfigs = customConfigs;
  _brazeSdkAuthenticationErrorHandler = brazeSdkAuthenticationErrorHandler;

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

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