groceries_manager/lib/models/enums/temperature_mode.dart
2025-01-05 16:01:21 +07:00

23 lines
539 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

enum TemperatureMode {
refrigerated,
frozen,
dryRoom,
unspecified;
factory TemperatureMode.fromName(String name) {
for (final v in values) {
if (v.name == name) {
return v;
}
}
return unspecified;
}
String get betterName => switch (this) {
TemperatureMode.refrigerated => "Охлаждённое",
TemperatureMode.frozen => "Замороженное",
TemperatureMode.dryRoom => "Сухое",
TemperatureMode.unspecified => "Не указано",
};
}