fromMks method

Number fromMks(
  1. dynamic mks
)

Calculates and returns the value in the units represented by this Units object of mks (that is expected to be in SI-MKS units). The method accepts a num or Number object; any other type will cause a QuantityException.

Implementation

Number fromMks(dynamic mks) {
  if (mks is num) {
    if (offset == 0) return Double(mks.toDouble()) / convToMKS;
    return (Double(mks.toDouble()) / convToMKS) - objToNumber(offset);
  } else if (mks is Number) {
    if (offset == 0) return mks / convToMKS;
    return (mks / convToMKS) - objToNumber(offset);
  } else {
    throw const QuantityException('num or Number expected');
  }
}