showAd method
Shows a confirmation dialog, if the user confirms it the ad is shown. The returned ResponseInterstitial details the ourtcome.
Call fetchAd before calling this method.
Implementation
Future<ResponseInterstitial> showAd() async {
if (_completer.isCompleted == false) {
if (_adToShow == null) {
_completer.complete(
ResponseInterstitial(StatusInterstitial.notLoadedGenerally));
} else if (_adToShow != null) {
await _adToShow?.show();
// errors might occur during show() and complete the completer in fetchAd().
if (_completer.isCompleted == false) {
_completer.complete(
ResponseInterstitial(StatusInterstitial.displaySuccess));
}
}
}
return _completer.future;
}