unified_ads_platform_interface 1.0.0
unified_ads_platform_interface: ^1.0.0 copied to clipboard
Common platform interface for unified_ads: the AdNetworkAdapter contract, shared ad models, and the adapter registry.
unified_ads_platform_interface #
The common platform interface for unified_ads. It contains:
- the
AdNetworkAdaptercontract that every network adapter implements; - the shared models (
AdConfig,NetworkConfig,AdError,AdEvent,BannerSize,RewardItem, …); - the
AdapterRegistrythat adapters register with from theirdartPluginClass; - the
ConsentProvider/TrackingAuthorizationabstractions; - the pluggable
AdsLogger, which is silent by default.
App developers don't depend on this package directly. unified_ads re-exports all of it.
It is meant for adapter authors. Most adapters extend BridgedAdNetworkAdapter, which implements the contract once:
it never throws, maps PlatformException → AdError, tracks loaded ads, and translates native events. A new adapter then
only provides its Pigeon host API. The step-by-step checklist is
TEMPLATE.md, and the
contract is described in ARCHITECTURE.md §5.
class MyNetworkAdapter extends BridgedAdNetworkAdapter {
/// Called by Flutter's plugin registrant (pubspec `dartPluginClass`).
static void registerWith() {
AdapterRegistry.instance.register(MyNetworkAdapter());
}
// ...
}
The core never depends on an adapter. Adapters depend only on this package, which is why an app links exactly the networks it adds.