companion library

Building blocks shared by the companion packages (prebid_mobile_sdk_gam, prebid_mobile_sdk_admob, prebid_mobile_sdk_max).

Not meant for apps, which use package:prebid_mobile_sdk/prebid_mobile_sdk.dart and the companion packages' own libraries. It follows semantic versioning like the rest of the package: a breaking change to it comes only with a new major version, so a companion package depending on prebid_mobile_sdk: ^1.0.0 keeps working with every 1.x release.

Classes

AdViewChannel
The method channel of one native ad view, named before the view exists.
CompanionAdChannel
A companion package's method channel for fullscreen ads, shared by every ad of one kind (e.g. prebid_mobile_sdk_gam/interstitial).
CompanionFullscreenAd
Base class of the companion packages' interstitial and rewarded ads.
PreloadedBanner
The Dart side of one preloaded banner (ADR-0008), shared by the core's PrebidPreloadedBannerAd and the companion packages' preloaded banners.
PreloadedBannerView
Shows a PreloadedBanner at the size it reports; the slot stays empty while the banner isn't loaded. Removing the view keeps the banner.

Mixins

AdViewState<T extends StatefulWidget>
The state of a widget that shows one native ad view: the core PrebidBannerAd and the companion packages' banner and native ads.

Functions

adEventError(Object? args) → String
The error message of a failure event: the payload itself (a String) or its error entry.
dispatchBannerEvent(PrebidBannerAdListener? listener, PrebidBannerVideoListener? videoListener, MethodCall event) → bool
Calls the listener or videoListener callback for a banner view event. Returns whether the event is one of theirs.
dispatchInterstitialEvent(PrebidInterstitialAdListener? listener, String event, Map? args) → bool
Calls the listener callback for an interstitial event. Returns whether the event is one of PrebidInterstitialAdListener's.
dispatchRewardedEvent(PrebidRewardedAdListener? listener, String event, Map? args) → bool
Calls the listener callback for a rewarded event. Returns whether the event is one of PrebidRewardedAdListener's.
flatSizes(List<Size> sizes) → List<int>
sizes as the flat [width, height, ...] list of whole dps the native banner views read (additionalSizes).
impOrtbWithGpid(String? impOrtbConfig, String? gpid) → String?
impOrtbConfig with ext.gpid set to gpid (unless it already sets one), for ad units without a GPID setter. Unchanged without a gpid or when impOrtbConfig is not a JSON object.
impOrtbWithPbAdSlot(String? impOrtbConfig, String? pbAdSlot) → String?
impOrtbConfig with ext.data.pbadslot set to pbAdSlot (unless it already sets one), for ad units without a pbAdSlot setter. Unchanged without a pbAdSlot or when impOrtbConfig is not a JSON object.
rewardFromPayload(Map? args) → PrebidReward
Builds the PrebidReward of an onUserEarnedReward payload. Every companion sends the same keys (rewardType, rewardCount and, when the SDK provides one, rewardExt as a JSON string or map), so rewards look the same whichever ad server renders them.

Typedefs

CompanionAdEventHandler = void Function(String event, Map? args)
Handles one native event for an ad: the event name and its payload.