setFieldValue method

dynamic setFieldValue(
  1. int fieldID,
  2. Object? value
)
override

Set a field's value by fieldId. Primitive types must be "boxed" in the appropriate object wrapper type.

Implementation

setFieldValue(int fieldID, Object? value) {
  switch (fieldID) {
    case FAILED_PARTS:
      if (value == null) {
        unsetFailed_parts();
      } else {
        this.failed_parts = value as List<PartitionResult>;
      }
      break;

    case LATENCY_IN_US:
      if (value == null) {
        unsetLatency_in_us();
      } else {
        this.latency_in_us = value as int;
      }
      break;

    case LATENCY_DETAIL_US:
      if (value == null) {
        unsetLatency_detail_us();
      } else {
        this.latency_detail_us = value as Map<String, int>;
      }
      break;

    default:
      throw new ArgumentError("Field $fieldID doesn't exist!");
  }
}