toMks method
Calculates and returns the value in SI-MKS units of the specified value
(that is implicitly in these units).
The method expects value
to be a num or Number object; any other type will
cause a QuantityException.
Implementation
Number toMks(dynamic value) {
if (value is num || value is Number) {
Number term;
if (value is Precise) {
// Preserve the Precise value's precision.
var preciseConv =
Precise(convToMKS.toString(), sigDigits: value.precision + 1);
term = preciseConv * value;
if (offset == 0) return term;
return term +
Precise(offset.toString(), sigDigits: value.precision + 1);
} else {
term = convToMKS * value;
if (offset == 0) return term;
return term + objToNumber(offset);
}
} else {
throw const QuantityException('num or Number expected');
}
}