toUnit method

Unit toUnit()

Implementation

Unit toUnit() {
  switch (this) {
    case 'NONE':
      return Unit.none;
    case 'SECONDS':
      return Unit.seconds;
    case 'MICRO_SECONDS':
      return Unit.microSeconds;
    case 'MILLI_SECONDS':
      return Unit.milliSeconds;
    case 'BYTES':
      return Unit.bytes;
    case 'KILO_BYTES':
      return Unit.kiloBytes;
    case 'MEGA_BYTES':
      return Unit.megaBytes;
    case 'GIGA_BYTES':
      return Unit.gigaBytes;
    case 'TERA_BYTES':
      return Unit.teraBytes;
    case 'BITS':
      return Unit.bits;
    case 'KILO_BITS':
      return Unit.kiloBits;
    case 'MEGA_BITS':
      return Unit.megaBits;
    case 'GIGA_BITS':
      return Unit.gigaBits;
    case 'TERA_BITS':
      return Unit.teraBits;
    case 'PERCENT':
      return Unit.percent;
    case 'COUNT':
      return Unit.count;
    case 'BYTES_PER_SECOND':
      return Unit.bytesPerSecond;
    case 'KILO_BYTES_PER_SECOND':
      return Unit.kiloBytesPerSecond;
    case 'MEGA_BYTES_PER_SECOND':
      return Unit.megaBytesPerSecond;
    case 'GIGA_BYTES_PER_SECOND':
      return Unit.gigaBytesPerSecond;
    case 'TERA_BYTES_PER_SECOND':
      return Unit.teraBytesPerSecond;
    case 'BITS_PER_SECOND':
      return Unit.bitsPerSecond;
    case 'KILO_BITS_PER_SECOND':
      return Unit.kiloBitsPerSecond;
    case 'MEGA_BITS_PER_SECOND':
      return Unit.megaBitsPerSecond;
    case 'GIGA_BITS_PER_SECOND':
      return Unit.gigaBitsPerSecond;
    case 'TERA_BITS_PER_SECOND':
      return Unit.teraBitsPerSecond;
    case 'COUNT_PER_SECOND':
      return Unit.countPerSecond;
  }
  throw Exception('$this is not known in enum Unit');
}