convert method
Converts a unit with a specific name (e.g. ANGLE.degree) and value to all other units
Implementation
@override
void convert(dynamic name, double? value) {
assert(name.runtimeType == T);
if (value == null) {
for (Unit unit in _unitList) {
unit.value = null;
unit.stringValue = null;
}
return;
}
numeratorProperty.convert(name.numerator, value);
denominatorProperty.convert(name.denominator, 1.0);
for (var i = 0; i < size; i++) {
_unitList[i].value =
numeratorProperty.getUnit(_unitList[i].name.numerator).value! /
denominatorProperty.getUnit(_unitList[i].name.denominator).value!;
_unitList[i].stringValue = valueToString(_unitList[i].value!,
significantFigures, removeTrailingZeros, useScientificNotation);
}
}