handleAdLoaded method

Stream<FastRewardedAdBlocState> handleAdLoaded()

Handles the event when an ad is successfully loaded.

Implementation

Stream<FastRewardedAdBlocState> handleAdLoaded() async* {
  if (currentState.isLoadingAd && currentState.requestId != null) {
    debugLog(
      'Ad loaded. Request id: ${currentState.requestId}',
      debugLabel: debugLabel,
    );

    yield currentState.copyWith(
      hasLoadedAd: true,
      isLoadingAd: false,
    );

    _admobService!.showAdIfAvailable(currentState.requestId!);
  }
}