dev
dart 20 lines 640 Bytes
Raw
1 import 'package:cw_core/enumerable_item.dart';
2
3 class OrderSourceDescription extends EnumerableItem<int> with Serializable<int> {
4 const OrderSourceDescription({required String title, required int raw})
5 : super(title: title, raw: raw);
6
7 static const buy = OrderSourceDescription(title: 'Buy', raw: 0);
8 static const order = OrderSourceDescription(title: 'Order', raw: 1);
9
10 static OrderSourceDescription deserialize({required int raw}) {
11 switch (raw) {
12 case 0:
13 return buy;
14 case 1:
15 return order;
16 default:
17 throw Exception('Invalid OrderSourceDescription raw value: $raw');
18 }
19 }
20 }