mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
subspace model
This commit is contained in:
31
lib/utils/constants/action_enum.dart
Normal file
31
lib/utils/constants/action_enum.dart
Normal file
@ -0,0 +1,31 @@
|
||||
enum Action {
|
||||
update,
|
||||
add,
|
||||
delete,
|
||||
}
|
||||
|
||||
extension ActionExtension on Action {
|
||||
String get value {
|
||||
switch (this) {
|
||||
case Action.update:
|
||||
return 'update';
|
||||
case Action.add:
|
||||
return 'add';
|
||||
case Action.delete:
|
||||
return 'delete';
|
||||
}
|
||||
}
|
||||
|
||||
static Action fromValue(String value) {
|
||||
switch (value) {
|
||||
case 'update':
|
||||
return Action.update;
|
||||
case 'add':
|
||||
return Action.add;
|
||||
case 'delete':
|
||||
return Action.delete;
|
||||
default:
|
||||
throw ArgumentError('Invalid action: $value');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user