CASAppOpen.createAndLoad constructor

CASAppOpen.createAndLoad({
  1. String? casId,
  2. bool autoReload = false,
  3. bool autoShow = false,
  4. String? placement,
  5. OnScreenAdCallback? onAdLoaded,
  6. OnAdFailedCallback? onAdFailedToLoad,
  7. OnAdFailedCallback? onAdFailedToShow,
  8. OnScreenAdCallback? onAdShowed,
  9. OnAdContentCallback? onAdImpression,
  10. OnAdCallback? onAdClicked,
  11. OnScreenAdCallback? onAdDismissed,
})

Create CASAppOpen and load ad content.

  • casId - The unique identifier of the CAS content for each platform. Leave null to use the initialization identifier.
  • autoReload - If enabled, the ad will automatically load new content when the current ad is dismissed or completed. Additionally, it will automatically retry loading the ad if an error occurs during the loading process.
  • autoShow - If enabled, the ad will automatically displayed when the user returns to the app.
  • placement - An optional placement name for the ad instance that helps categorize and track statistics across different ad placements.
  • onAdLoaded - Callback to be invoked when the ad content has been successfully loaded.
  • onAdFailedToLoad - Callback to be invoked when the ad content fails to load.
  • onAdFailedToShow - Callback to be invoked when the ad content fails to show.
  • onAdImpression - Callback to be invoked when an ad is estimated to have earned money.
  • onAdClicked - Callback to be invoked when the ad content is clicked by the user.
  • onAdDismissed - Callback to be invoked when the ad content is dismissed.

Implementation

CASAppOpen.createAndLoad({
  String? casId,
  bool autoReload = false,
  bool autoShow = false,
  super.placement,
  super.onAdLoaded,
  super.onAdFailedToLoad,
  super.onAdFailedToShow,
  super.onAdShowed,
  super.onAdImpression,
  super.onAdClicked,
  super.onAdDismissed,
}) : super(format: AdFormat.appOpen) {
  casInternalBridge.createAdInstance(
    ad: this,
    shouldLoad: true,
    casId: casId,
    arguments: <String, dynamic>{
      'autoload': autoReload,
      'autoshow': autoShow,
    },
  );
}