Skip to content

Commit 460b4b2

Browse files
committed
fix(ads): remove redundant ad disposal in AdMobAdProvider
- Remove ad.dispose() call in onAdFailedToLoad callback - Add comment explaining automatic ad disposal by SDK - Prevent potential race conditions and errors
1 parent 08013eb commit 460b4b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/ads/admob_ad_provider.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ class AdMobAdProvider implements AdProvider {
108108
},
109109
onAdFailedToLoad: (ad, error) {
110110
_logger.severe('Native Ad failed to load: $error');
111-
ad.dispose();
111+
// The ad object is automatically disposed by the SDK on failure.
112+
// Calling dispose here can lead to race conditions and errors.
112113
completer.complete(null);
113114
},
114115
onAdClicked: (ad) {

0 commit comments

Comments
 (0)