handlePatchValueEvent method

  1. @protected
Stream<S> handlePatchValueEvent(
  1. FastCalculatorBlocEventPayload<FastCalculatorResults>? payload
)

Handles the patch value event by updating a single field in the calculator state.

Takes a FastCalculatorBlocEventPayload containing the key and value to update.

If the state is successfully updated, saves the calculator state, emits the new state, and triggers the compute event with a debounce.

Yields a stream of state changes.

Implementation

@protected
Stream<S> handlePatchValueEvent(
  FastCalculatorBlocEventPayload? payload,
) async* {
  if (payload != null && payload.key != null) {
    final state = await patchCalculatorState(payload.key!, payload.value);
    yield* processCalculatorValueChange(state);
  }
}