Closed fbuireu closed 3 years ago
Found another workaround: create 1 stateful widget that loads the add. This gives me control over Flutter's widget tree and over navigation observer.
having the user wait while your ad is loaded is not a good practice.
I'd suggest to create a preloaded pool. a limited set of interstitials ready to be shown.
whenever you show one of them, that should trigger a load of another ad for next time.
that way, all the retries occur in the background without the user waiting
According to the examples page all the used views are
Stateful
. However, I'd like to useStateless
widgets (if possible). I am creating a service to load and show ads (interstitial in this case). My goal is to call them during the user's navigation.I have something like:
The ad is loaded (
loadInterstitialAd
) properly (logs are shown, etc). However, when I try to show them (showInterstitialAd
) it always validates the condition_interstitialAd == null
. Even if at this point I callloadInterstitialAd
the ad results tonull
.If I call
showInterstitialAd
in theonAdLoaded
callback, then, the ad is prompted although I lose a little bit of control in this scenario, so I'd like to keep both functions separated.I'm wondering if I have some scope/injection issues or it's something internal like needing stateful widgets because, as the docs point, it's statically placed: