In my test application, when ontap is running, I want to show the award-winning ad with seconds and then the quiz to be loaded and the questions to be loaded. How can I do this? The code below does not show the ad because the ad is returned null and brings direct questions to the screen. How can I do it as I stated. Have a nice day.
my rewarded code
@override
void initState() {
super.initState();
initRewardedAd();
}
RewardedAd? rewardedAd;
void initRewardedAd() {
RewardedAd.load(
adUnitId: KAdStrings.rewardedAd1,
request: const AdRequest(),
rewardedAdLoadCallback: RewardedAdLoadCallback(
onAdLoaded: (ad){
setState(() {
rewardedAd = ad;
});
},
onAdFailedToLoad:(error ) {
setState(() {
rewardedAd = null;
});
})
);
}
void _showRewardedAd() {
if (rewardedAd != null) {
rewardedAd!.fullScreenContentCallback = FullScreenContentCallback(
onAdDismissedFullScreenContent: (ad) {
print('dissmiss');
ad.dispose();
initRewardedAd();
},
onAdFailedToShowFullScreenContent: (ad, error) {
print('fail');
ad.dispose();
initRewardedAd();
},
);
rewardedAd!.show(
onUserEarnedReward: (ad, error) {
print('gosterildi');
}
);
}
}
```
my onTap to quiz code
```
@override
Widget build(BuildContext context) {
return ListView(shrinkWrap: true, children: [
Column(
children: [
ListTile(
onTap: () {
_showRewardedAd();
Get.to(sorubir());
},
title: const Text('TEST 1'),
subtitle: const Text('Soru Sayısı:50, Süre:45 Dakikadır Başarılar'),
),
],
)
]);
}
```