recalculateQuantityFromUOMStringToCurrent method
double?
recalculateQuantityFromUOMStringToCurrent({
- required double quantity,
- required String unitString,
- required UnitOfMeasuresDto? currentUOM,
- required List<
UnitOfMeasuresDto> altUOMs,
Implementation
double? recalculateQuantityFromUOMStringToCurrent({
required double quantity,
required String unitString,
required UnitOfMeasuresDto? currentUOM,
required List<UnitOfMeasuresDto> altUOMs,
}) {
final unit = uomFromString(uom: unitString, altUOMs: altUOMs);
if (unit == null || currentUOM == null) return null;
if (unit == currentUOM) return quantity;
return unit.convertQuantity(
newUnit: currentUOM,
value: quantity,
);
}