handleInitializedEvent method

Stream<FastAppInfoBlocState> handleInitializedEvent(
  1. FastAppInfoDocument document
)

Implementation

Stream<FastAppInfoBlocState> handleInitializedEvent(
  FastAppInfoDocument document,
) async* {
  if (isInitializing) {
    _logger.debug('Initialized');
    isInitialized = true;

    final nextDocument = document.copyWith(
      appLaunchCounter: document.appLaunchCounter + 1,
    );

    await _dataProvider.persistAppInfo(nextDocument);

    var tmpState = FastAppInfoBlocState.fromDocument(nextDocument);

    tmpState = currentState.merge(tmpState).copyWith(
          isInitializing: false,
          isInitialized: true,
        );

    _logger.info('Is first launch', tmpState.isFirstLaunch);

    yield tmpState;
  }
}