convert method

double convert(
  1. int value,
  2. TypeDataConvert typeFrom,
  3. TypeDataConvert typeTo
)

Implementation

double convert(
  int value,
  TypeDataConvert typeFrom,
  TypeDataConvert typeTo,
) {
  if (typeFrom == TypeDataConvert.byte) {
    if (typeTo == TypeDataConvert.gigaByte) {
      return value / gbConstant;
    } else if (typeTo == TypeDataConvert.megaByte) {
      return value / mbConstant;
    } else if (typeTo == TypeDataConvert.kiloByte) {
      return value / kbConstant;
    } else {
      return value * bitConstant;
    }
  } else {
    return value.toDouble();
  }
}