getStateById method

CubitStateEntity getStateById({
  1. required ID cubitID,
  2. required ID stateID,
})

Implementation

CubitStateEntity getStateById({required ID cubitID, required ID stateID}) {
  final cubit = state.getCubitByID(cubitID);

  final cubitState = cubit.states[stateID];
  if (cubitState == null) {
    Logger.printError('State not found in cubit');
    throw Exception('State not found in AppCubit');
  }
  return cubitState;
}