PipAdView class

A class to manage and display interstitial ads using platform-specific native views.

This class allows you to show an interstitial ad by invoking native code via a method channel and listen for ad events through an event channel.

Example usage:

final interstitialAdView = InterstitialAdView();
await interstitialAdView.showInterstitialAdView(
  adData: adMap,
  width: 300,
  height: 250,
  onAdClicked: (ad) => print("Ad clicked: $ad"),
  onAdAppeared: (ad, ubid) => print("Ad appeared: $ad, cliUbid: $ubid"),
);

Displays the interstitial ad and starts listening for ad events.

This method triggers the native interstitial ad view with the given parameters and sets up a listener to handle adClicked and adAppeared events.

Parameters:

  • adData (Map<String, dynamic>): Required ad metadata to display the ad.
  • width (int?): Optional width of the interstitial ad view in pixels.
  • height (int?): Optional height of the interstitial ad view in pixels.
  • onAdClicked (void Function(Map? ad)?): Optional callback triggered when the ad is clicked.
  • onAdAppeared (void Function(Map? ad, String? cliUbid?): Optional callback triggered when the ad appears.

Returns: Future<void> . ``

Constructors

PipAdView()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Disposes the current instance by canceling any active event subscriptions.
hidePip() Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resumePip({Duration delay = const Duration(milliseconds: 300)}) → void
showPipAdView({required BuildContext context, required Map<String, dynamic> adData, int? width, int? height, int? x, int? y, String? adLabelText, String? adLabelAlignment, void onAdClicked(Map? ad)?, void onAdAppeared(Map? ad, String? trackingId)?, required OsmosConfig config}) Future<void>?
Displays the interstitial ad and starts listening for ad events.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited