stringToUnit function

Unit stringToUnit(
  1. String type
)

Implementation

Unit stringToUnit(String type) {
  if (type.toLowerCase() == 'metric') return Unit.metric;
  if (type.toLowerCase() == 'imperial') return Unit.imperial;
  return null;
}