handleInitializedEvent method

  1. @protected
Stream<S> handleInitializedEvent()

Handles the initialized event by updating the isInitialized and isInitializing flags.

After updating the flags, it emits the new state and triggers the compute event.

Yields a stream of state changes.

Implementation

@protected
Stream<S> handleInitializedEvent() async* {
  if (isInitializing) {
    debugLog('Calculator initialized', debugLabel: debugLabel);

    isInitialized = true;

    defaultCalculatorState = defaultCalculatorState.copyWith(
      isInitializing: isInitializing,
      isInitialized: isInitialized,
    ) as S;

    yield currentState.copyWith(
      isInitializing: isInitializing,
      isInitialized: isInitialized,
    ) as S;

    addComputeEvent();
  }
}