showTaskCompletionAd static method
Example 2: Show interstitial after task completion
Implementation
static void showTaskCompletionAd({required VoidCallback onTaskComplete}) {
AdHelper.showInterstitial(
onInterstitialShown: () {
print('🎬 Task completion ad started');
// Maybe pause background processes
},
onAdClosed: () {
print('✅ Task completion ad finished');
// Award task reward and continue
onTaskComplete();
},
onAdNotReady: () {
print('⚠️ No completion ad available');
// Still complete the task
onTaskComplete();
},
onAdFailedToShow: () {
print('❌ Completion ad failed');
// Don't penalize user for ad failure
onTaskComplete();
},
);
}