handleInitEvent method

Handles the init event and initializes the BLoC.

Implementation

Stream<FastRewardedAdBlocState> handleInitEvent(
  FastRewardedAdBlocEventPayload payload,
) async* {
  if (canInitialize) {
    assert(payload.adInfo != null);
    assert(payload.adInfo?.rewardedAdUnitId != null);

    isInitializing = true;
    yield currentState.copyWith(isInitializing: true);

    blockDuration = payload.blockDuration ?? kFastAdRewardedBlockDuration;
    _admobService = FastAdmobRewardedAdService(payload.adInfo);
    _admobService!.addListener(this);

    addEvent(const FastRewardedAdBlocEvent.initialized());
  }
}