getAlternativeUnits method
Implementation
List<UnitOfMeasuresDto> getAlternativeUnits(UnitOfMeasures unitOfMeasures) {
return unitOfMeasures.results
.where((unitData) => unitData.altUnit.isNotNullOrEmpty)
.map((unitData) {
try {
return UnitOfMeasuresDto(
unit: unitData.altUnit ?? '',
numerator: double.parse(unitData.numerator!),
denominator: double.parse(unitData.denominatr!),
);
} catch (_) {
return null;
}
})
.whereType<UnitOfMeasuresDto>()
.toList();
}