convertResultToState method

S convertResultToState(
  1. Result result
)

Converts the result obtained from data resolution into a state.

Implementation

S convertResultToState(Result result) {
  // Update the result status based on the result
  state.resultStatus = _getStatusFromResult(result) ?? state.resultStatus;

  if (result.isSuccess) {
    state.item = result.data; // Populate the item if the result is successful
  }

  return state.copyWith(); // Return the new state based on the result
}