Guide to migrating to version 8
Version 8 of the Yandex Mobile Ads plugin for Flutter brings a variety of API updates to make integration easier and keep things consistent with our native SDKs.
Key changes
Renamed the MobileAds class to YandexAds.
We've renamed the following properties and methods:
|
SDK 7 |
SDK 8 |
|
|
|
|
|
|
Ad request
The AdRequestConfiguration class has been removed. Use AdRequest to configure your request — this is where you set the ad unit ID (adUnitId).
Targeting parameters (age, contextQuery, contextTags, gender, location) have been moved from AdRequest into a separate AdTargeting class.
|
Ad request |
SDK 7
SDK 8
|
Fullscreen formats: interstitial, rewarded, and app open ads
We've updated how you initialize loaders and request ads: the loader constructor is now called synchronously, while the loadAd method returns a Future containing the pre-loaded ad.
The InterstitialAdLoadListener, RewardedAdLoadListener, and AppOpenAdLoadListener classes have been removed. Use the loadAd result and standard error handling instead of callbacks.
|
Loading ads |
SDK 7 Setting up loaders asynchronously using callbacks:
SDK 8 Synchronous loader initialization;
|
The same rules apply to RewardedAdLoader and AppOpenAdLoader.
Banners
We've updated how you create and load banners: the constructor no longer accepts AdRequest or event handlers. You can now load ads via a separate load(AdRequest) call. To track loading progress and show events, subscribe to the loadStateStream and events streams.
|
Creating and loading a banner |
SDK 7
SDK 8
|
|
Destroying a banner |
SDK 7
SDK 8
|
AdInfo class
We've updated the structure of the AdInfo class: removed the adSize field and added the creatives, extraData, and partnerText fields.
|
SDK 7 |
SDK 8 |
|
|
Removed |
|
— |
|
|
— |
|
|
— |
|
Deleted events
The onLeftApplication, onReturnedToApplication, and onAdClose events are no longer supported. You need to remove the corresponding handlers from your code.