| 1 | enum TransactionDirection { incoming, outgoing } |
| 2 | |
| 3 | TransactionDirection parseTransactionDirectionFromInt(int raw) { |
| 4 | switch (raw) { |
| 5 | case 0: |
| 6 | return TransactionDirection.incoming; |
| 7 | case 1: |
| 8 | return TransactionDirection.outgoing; |
| 9 | default: |
| 10 | throw Exception( |
| 11 | 'Unexpected token: raw for TransactionDirection parseTransactionDirectionFromInt'); |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | TransactionDirection parseTransactionDirectionFromNumber(String raw) { |
| 16 | switch (raw) { |
| 17 | case "0": |
| 18 | return TransactionDirection.incoming; |
| 19 | case "1": |
| 20 | return TransactionDirection.outgoing; |
| 21 | default: |
| 22 | throw Exception( |
| 23 | 'Unexpected token: raw for TransactionDirection parseTransactionDirectionFromNumber'); |
| 24 | } |
| 25 | } |