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) {
      _log('ad is NULL, early abort');
      _completer.complete(
          ResponseInterstitial(StatusInterstitial.notLoadedGenerally));
    } else if (_adToShow != null) {
      await _adToShow?.show();
      _log('show() starting ... ');

      if (_completer.isCompleted == false) {
        _isShown = true;
      }
    }
  }

  return _completer.future;
}