stringToUnit static method
Returns the Unit described by s
Implementation
static Unit? stringToUnit(String? s) {
if (s == null || s.isEmpty) {
return null;
}
if (s[0] == String.fromCharCode(0x03BC)) {
// greek letter mu
if (s.length > 1 && s.substring(1) == 'g') {
return Unit.MICRO_G;
}
return Unit.UNKNOWN;
}
return _UNITS[s] ?? Unit.UNKNOWN;
}