Rewarded Ads
This guide explains how to integrate rewarded ads into a Flutter app.
Rewarded ads let you offer users in-app items, such as continued gameplay, virtual currency, or other rewards, in exchange for their engagement with ads. Rewarded ads boost engagement because users receive a tangible benefit for their time.
Rewarded Ad management in Dart code is handled through the CASRewarded class,
which extends the shared AdScreenInstance
class used for all fullscreen ads.
The AdScreenInstance
class, inherits from the base AdInstance
class, which is common for all CAS ad formats.
The AdScreenInstance
is displayed as an Overlay
on top of all app content and is positioned statically;
therefore, it cannot be added to the Flutter widget tree.
CAS provides an option to enable autoReload
to simplify your app logic. Before using the ad, you should decide whether to enable autoReload
, or manually manage each ad loading cycle in your code.
When autoReload
is enabled, a new ad will be automatically loaded after each display, and loading failures will trigger automatic retry attempts.
final bool isAutoReloadEnabled = true;
Manual load mode (autoReload: false
) is useful when you only need to show a single ad per app screen, and the screens change frequently.
Below is a diagram showing the ad lifecycle and how autoReload
(isAutoload) affects it.

Create Ad instance
The following example creates and loads an rewarded video ad:
class AppScreenState extends State<AppScreen> {
late CASRewarded _rewardedAd;
@override
void initState() {
super.initState();
_rewardedAd = CASRewarded.createAndLoad(
autoReload: isAutoReloadEnabled,
onAdLoaded: (AdScreenInstance ad) {
// Called when an ad is successfully loaded.
print('$ad loaded');
},
onAdFailedToLoad: (AdInstance ad, AdError error) {
// Called when an ad load failed.
print('$ad failed to load: ${error.message}.');
},
);
}
}
Ad content may take some time to load after creating an ad instance. To ensure the ad displays instantly when needed, create the ad instance in advance. Use the onAdLoaded
callback to be notified when the ad is ready for display.
CAS provides functionality to create and preload multiple ad instances in advance, ensuring uninterrupted sequential ad delivery. Mediation ads are loaded in order for each created instance.
Ad content callbacks
CASRewarded
has several optional callbacks for the ad lifecycle. These callbacks can be set either as arguments in the createAndLoad()
function or later via the properties of the ad instance.
_rewardedAd.onAdFailedToShow = (AdInstance ad, AdError error) {
// Called when the ad failed to show full screen content.
print('$ad failed to show: ${error.message}.');
};
_rewardedAd.onAdShowed = (AdScreenInstance ad) {
// Called when the ad showed the full screen content.
print('$ad showed');
};
_rewardedAd.onAdImpression = (AdInstance ad, AdContentInfo contentInfo) {
// Called when an impression occurs on the ad.
print('$ad impression');
};
_rewardedAd.onAdClicked = (AdInstance ad) {
// Called when a click is recorded for an ad.
print('$ad clicked');
};
_rewardedAd.onAdDismissed = (AdScreenInstance ad) {
// Called when the ad dismissed full screen content.
print('$ad dismissed');
};
- Read more about
AdContentInfo
structure in Impression Level Data. - When an error occurs during ad impression, executed the
onAdFailedToShow
only. In this case theonAdDismissed
will not be executed, since the impression is not considered successful.
Show Ad
Be sure to implement onUserEarnedReward
callback and reward the user for watching an ad.
You can choose when to show the ad by calling show()
:
_rewardedAd.onUserEarnedReward = (AdScreenInstance ad) {
print('Reward the user for watching the $ad');
};
_rewardedAd.show();
The onUserEarnedReward
callback differs from onAdDismissed
because the user might not fulfill the requirements to receive the reward even after watching the ad.
If the ad is not ready at that moment, the onAdFailedToShow
callback will be triggered with a reason provided in the AdError
.
You have the option to check isLoaded
if it's required by your app's logic.
bool isAdLoaded = await _rewardedAd.isLoaded();
Release ad resource
Be sure to release ad resources if you’re no longer going to use the ad instance.
@override
void dispose() {
_rewardedAd.dispose();
super.dispose();
}
It may be useful to store the ad instance in static memory for reuse across multiple screens. This way, you don't need to call dispose()
and can show the already loaded ad without delay.
Manual reload Ad
When you want to manually control ad loading, use the load()
function on the created ad instance to retry loading with the same configuration.
_rewardedAd.load();
Extra fill by Interstitial Ad
CAS provides the option to load the interstitial ads as a fallback when a rewarded video ad has no available fill. Interstitial ads do not require the user to watch the entire ad to completion. However, the onUserEarnedReward
will still be triggered as if the user completed the rewarded video.
_rewardedAd = CASRewarded.createAndLoad(
extraFillByInterstitialAd: true,
...
)
Mute Ad sounds
Indicates if the application’s audio is muted. Affects initial mute state for fullscreen ads. Use this method only if your application has its own volume controls (e.g., custom music or sound effect muting).
CASMobileAds.setAdSoundsMuted(true);
Not muted by default.