tryParse static method
Implementation
static StockUnit tryParse(String val) {
switch (val) {
case 'box':
return StockUnit.unit;
case 'centiliter':
return StockUnit.centiliter;
case 'centimeter':
return StockUnit.centimeter;
case 'gram':
return StockUnit.gram;
case 'kilogram':
return StockUnit.kilogram;
case 'liter':
return StockUnit.liter;
case 'meter':
return StockUnit.meter;
case 'unit':
return StockUnit.unit;
default:
print('$val is not a valid StockUnit');
return StockUnit.unknown;
}
}