I use this plugin
facebook_audience_network 0.5.0
and I implemented this by this way
class FacebookAd{
static void faceInit() {
FacebookAudienceNetwork.init(
testingId: "xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx",
);
}
static widget myBanner;
static void showBannerAd() {
myBanner = FacebookBannerAd(
placementId: "xxxxxxxxx_xxxxxxxxxxx",
keepAlive: true,
bannerSize: BannerSize.STANDARD,
listener: (result, value) {
print("Banner Ad: $result --> $value eee");
switch (result) {
case BannerAdResult.ERROR:
print("Error: $value");
break;
case BannerAdResult.LOADED:
print("Loaded: $value");
break;
case BannerAdResult.CLICKED:
print("Clicked: $value");
break;
case BannerAdResult.LOGGING_IMPRESSION:
print("Logging Impression: $value");
break;
}
},
);
}
}
}
and from other classes
return Scaffold(
bottomNavigationBar: FacebookAd.myBanner
)
so in the app, all of screens refer variable "myBanner" to show banner inside "bottomNavigationBar"
but the problem is when the screen is changed using pushNamed("/xxx")
sometimes the screen showing banner and sometimes not ! (mostly not)
how do I solve this problem this?
thank you