decode method Null safety

XdrSCHostFnErrorCode decode(
  1. XdrDataInputStream stream
)

Implementation

static XdrSCHostFnErrorCode decode(XdrDataInputStream stream) {
  int value = stream.readInt();
  switch (value) {
    case 0:
      return HOST_FN_UNKNOWN_ERROR;
    case 1:
      return HOST_FN_UNEXPECTED_HOST_FUNCTION_ACTION;
    case 2:
      return HOST_FN_INPUT_ARGS_WRONG_LENGTH;
    case 3:
      return HOST_FN_INPUT_ARGS_WRONG_TYPE;
    case 4:
      return HOST_FN_INPUT_ARGS_INVALID;
    default:
      throw Exception("Unknown enum value: $value");
  }
}