AdsLoader class
Allows publishers to request ads from ad servers or a dynamic ad insertion stream.
Platform-Specific Features
This class contains an underlying implementation provided by the current platform. Once a platform implementation is imported, the examples below can be followed to use features provided by a platform's implementation.
Below is an example of setting platform-specific creation parameters for iOS and Android:
PlatformAdsLoaderCreationParams params =
const PlatformAdsLoaderCreationParams();
if (InteractiveMediaAdsPlatform.instance is IOSInteractiveMediaAdsPlatform) {
params = IOSAdsLoaderCreationParams
.fromPlatformAdsLoaderCreationParams(
params,
);
} else if (InteractiveMediaAdsPlatform.instance is AndroidInteractiveMediaAdsPlatform) {
params = AndroidAdsLoaderCreationParams
.fromPlatformAdsLoaderCreationParams(
params,
);
}
final AdsLoader loader = AdsLoader.fromPlatformCreationParams(
params,
);
Below is an example of accessing the platform-specific implementation for iOS and Android:
final AdsLoader loader = AdsLoader();
if (InteractiveMediaAdsPlatform.instance is IOSInteractiveMediaAdsPlatform) {
final IOSAdsLoader iosLoader = loader.platform as IOSAdsLoader;
} else if (InteractiveMediaAdsPlatform.instance is AndroidInteractiveMediaAdsPlatform) {
final AndroidAdsLoader androidLoader =
loader.platform as AndroidAdsLoader;
}
Constructors
- AdsLoader({required AdDisplayContainer container, required void onAdsLoaded(OnAdsLoadedData data), required void onAdsLoadError(AdsLoadErrorData data)})
- Constructs an AdsLoader.
- AdsLoader.fromPlatform(PlatformAdsLoader platform)
- Constructs a AdsLoader from a specific platform implementation.
- AdsLoader.fromPlatformCreationParams(PlatformAdsLoaderCreationParams params)
- Constructs an AdsLoader from creation params for a specific platform.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- platform → PlatformAdsLoader
-
Implementation of
PlatformAdsLoader
for the current platform.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
contentComplete(
) → Future< void> - Signals to the SDK that the content has completed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestAds(
AdsRequest request) → Future< void> - Requests ads from a server.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited