handleInitEvent method
Handles the FastStoreBlocEventType.init event to initialize the store.
Implementation
Stream<FastStoreBlocState> handleInitEvent(
FastStoreBlocPayload payload,
) async* {
if (canInitialize) {
assert(payload.appInfo != null, 'appInfo cannot be null');
isInitializing = true;
yield currentState.copyWith(isInitializing: true);
_iapService = FastInAppPurchaseService(
appInfo: payload.appInfo!,
errorReporter: payload.errorReporter,
);
_listenToPurchases();
_listenToErrors();
await _iapDataProvider.connect();
_isStoreAvailable = await retry<bool>(
task: () async => _iapService!.connect(),
taskTimeout: kFastAsyncTimeout,
maxAttempts: 2,
);
addEvent(const FastStoreBlocEvent.initialized());
}
}