Hi Walker,
Thank you for contacting the Mobile Ads SDK Support team.
Upon reviewing your concern, I understand that you need to know about how to close Rewarded AD after the user earned a reward. To close a Rewarded Ad after a user has earned a reward, you can use the following code:
rewardedAd.onUserEarnedReward.listen((reward) {
// Close the ad.
rewardedAd.dispose();
});
The rewardedAd.show() method will show the Rewarded Ad. The
rewardedAd.onUserEarnedReward event will be fired when the user earns a reward. The reward object will contain information about the reward that the user has earned. The rewardedAd.dispose() method will close the Rewarded Ad.
Here is an example of how to use this code:
import 'package:google_mobile_ads/google_mobile_ads.dart';
void main() {
// Initialize the Mobile Ads SDK.
MobileAds.initialize();
// Create a RewardedAd object.
RewardedAd rewardedAd = RewardedAd(
adUnitId: 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
);
// Load the RewardedAd.
rewardedAd.loadAd();
// Listen for the RewardedAd event.
rewardedAd.onUserEarnedReward.listen((reward) {
// Close the ad.
rewardedAd.dispose();
});
}
Kindly refer to the Rewarded implementation documentation for more details about it.
Please reach out to us, if you need any further assistance.
![]() |
Mobile Ads SDK Team |