AndriousSolutions / ads

Other
58 stars 11 forks source link

the show local variable is shadowed in showBannerAd() (double declaration) #21

Closed SirJohn2024 closed 3 years ago

SirJohn2024 commented 4 years ago
    bool show = false;
    // Can only have one instantiated Ads object.
    if (!_firstObject) return show;

    if (_bannerAd == null) {
      bool show = await setBannerAd(

should be:

    bool show = false;
    // Can only have one instantiated Ads object.
    if (!_firstObject) return show;

    if (_bannerAd == null) {
      show = await setBannerAd(
Andrious commented 4 years ago

Oh thanks! I didn't realize. I'll look into it as soon as I can.

Andrious commented 4 years ago

Thanks again, Sergio.

You'll find the fix now in version, 1.5.1

SirJohn2024 commented 4 years ago

I've tried the new version, and now, from time to time, I got no ad and this error logged on the logcat, even if showBannerAd returns ok:

W/flutter: onAdFailedToLoad: 3

Andrious commented 4 years ago

I see. I'll see if it's the plugin itself, today. Is this when repeatedly 'closed' and shown again and again? Do you see 'any pattern' and or any clue as to why it fails to load from time to time? Would you have an opinion as to the reason?

Regards.

SirJohn2024 commented 4 years ago

It can be related to this: https://github.com/flutter/flutter/issues/28733