getBanner method
Use the widget AdBanner instead of using this method.
Returns a ResponseBanner which contains a status and potentially a BannerAd
.
Implementation
Future<ResponseBanner> getBanner({String? adUnitId}) async {
if (isDisabledProgrammatically()) {
return ResponseBanner(StatusBanner.displayDeniedProgrammatically);
}
if (_isInitialized == false) {
return ResponseBanner(StatusBanner.notLoadedInitialized);
}
if (_bannerMap[adUnitId] == null && _bannerMap.isEmpty) {
return ResponseBanner(StatusBanner.notLoadedAdIdNotSet);
}
adUnitId ??= _bannerMap.keys.first;
final result = await _bannerMap[adUnitId]!.getAd();
_bannerMap[adUnitId]!.fetchAd(); // no await
return result;
}