Add default values for hive fields for Node, UnspentCoinsInfo, Wallet… (#598)

* Add default values for hive fields for Node, UnspentCoinsInfo, WalletInfo, Order, Contact, TransactionDescription, Trade

mkyq committed Nov 4, 2022 at 15:55 UTC 5d741b183f5ef0a25852f568ee93e085abea4dfd
7 files changed +31 -31
cw_core/lib/node.dart
+2 -2
@@ -36,7 +36,7 @@ class Node extends HiveObject with Keyable {
36 static const typeId = 1;
37 static const boxName = 'Nodes';
38
39 - @HiveField(0)
39 + @HiveField(0, defaultValue: '')
40 late String uriRaw;
41
42 @HiveField(1)
@@ -45,7 +45,7 @@ class Node extends HiveObject with Keyable {
45 @HiveField(2)
46 String? password;
47
48 - @HiveField(3)
48 + @HiveField(3, defaultValue: 0)
49 late int typeRaw;
50
51 @HiveField(4)
cw_core/lib/unspent_coins_info.dart
+4 -4
@@ -15,16 +15,16 @@ class UnspentCoinsInfo extends HiveObject {
15 static const boxName = 'Unspent';
16 static const boxKey = 'unspentBoxKey';
17
18 - @HiveField(0)
18 + @HiveField(0, defaultValue: '')
19 String walletId;
20
21 - @HiveField(1)
21 + @HiveField(1, defaultValue: '')
22 String hash;
23
24 - @HiveField(2)
24 + @HiveField(2, defaultValue: false)
25 bool isFrozen;
26
27 - @HiveField(3)
27 + @HiveField(3, defaultValue: false)
28 bool isSending;
29
30 @HiveField(4)
cw_core/lib/wallet_info.dart
+8 -8
@@ -33,31 +33,31 @@ class WalletInfo extends HiveObject {
33 static const typeId = 4;
34 static const boxName = 'WalletInfo';
35
36 - @HiveField(0)
36 + @HiveField(0, defaultValue: '')
37 String id;
38
39 - @HiveField(1)
39 + @HiveField(1, defaultValue: '')
40 String name;
41
42 @HiveField(2)
43 WalletType type;
44
45 - @HiveField(3)
45 + @HiveField(3, defaultValue: false)
46 bool isRecovery;
47
48 - @HiveField(4)
48 + @HiveField(4, defaultValue: 0)
49 int restoreHeight;
50
51 - @HiveField(5)
51 + @HiveField(5, defaultValue: 0)
52 int timestamp;
53
54 - @HiveField(6)
54 + @HiveField(6, defaultValue: '')
55 String dirPath;
56
57 - @HiveField(7)
57 + @HiveField(7, defaultValue: '')
58 String path;
59
60 - @HiveField(8)
60 + @HiveField(8, defaultValue: '')
61 String address;
62
63 @HiveField(10)
lib/buy/order.dart
+7 -7
@@ -30,10 +30,10 @@ class Order extends HiveObject {
30 static const boxName = 'Orders';
31 static const boxKey = 'ordersBoxKey';
32
33 - @HiveField(0)
33 + @HiveField(0, defaultValue: '')
34 String id;
35
36 - @HiveField(1)
36 + @HiveField(1, defaultValue: '')
37 String transferId;
38
39 @HiveField(2)
@@ -42,7 +42,7 @@ class Order extends HiveObject {
42 @HiveField(3)
43 String? to;
44
45 - @HiveField(4)
45 + @HiveField(4, defaultValue: '')
46 late String stateRaw;
47
48 TradeState get state => TradeState.deserialize(raw: stateRaw);
@@ -50,16 +50,16 @@ class Order extends HiveObject {
50 @HiveField(5)
51 DateTime createdAt;
52
53 - @HiveField(6)
53 + @HiveField(6, defaultValue: '')
54 String amount;
55
56 - @HiveField(7)
56 + @HiveField(7, defaultValue: '')
57 String receiveAddress;
58
59 - @HiveField(8)
59 + @HiveField(8, defaultValue: '')
60 String walletId;
61
62 - @HiveField(9)
62 + @HiveField(9, defaultValue: 0)
63 late int providerRaw;
64
65 BuyProviderDescription get provider =>
lib/entities/contact.dart
+3 -3
@@ -17,13 +17,13 @@ class Contact extends HiveObject with Keyable {
17 static const typeId = 0;
18 static const boxName = 'Contacts';
19
20 - @HiveField(0)
20 + @HiveField(0, defaultValue: '')
21 String name;
22
23 - @HiveField(1)
23 + @HiveField(1, defaultValue: '')
24 String address;
25
26 - @HiveField(2)
26 + @HiveField(2, defaultValue: 0)
27 late int raw;
28
29 CryptoCurrency get type => CryptoCurrency.deserialize(raw: raw);
lib/entities/transaction_description.dart
+1 -1
@@ -10,7 +10,7 @@ class TransactionDescription extends HiveObject {
10 static const boxName = 'TransactionDescriptions';
11 static const boxKey = 'transactionDescriptionsBoxKey';
12
13 - @HiveField(0)
13 + @HiveField(0, defaultValue: '')
14 String id;
15
16 @HiveField(1)
lib/exchange/trade.dart
+6 -6
@@ -40,26 +40,26 @@ class Trade extends HiveObject {
40 static const boxName = 'Trades';
41 static const boxKey = 'tradesBoxKey';
42
43 - @HiveField(0)
43 + @HiveField(0, defaultValue: '')
44 String id;
45
46 - @HiveField(1)
46 + @HiveField(1, defaultValue: 0)
47 late int providerRaw;
48
49 ExchangeProviderDescription get provider =>
50 ExchangeProviderDescription.deserialize(raw: providerRaw);
51
52 - @HiveField(2)
52 + @HiveField(2, defaultValue: 0)
53 late int fromRaw;
54
55 CryptoCurrency get from => CryptoCurrency.deserialize(raw: fromRaw);
56
57 - @HiveField(3)
57 + @HiveField(3, defaultValue: 0)
58 late int toRaw;
59
60 CryptoCurrency get to => CryptoCurrency.deserialize(raw: toRaw);
61
62 - @HiveField(4)
62 + @HiveField(4, defaultValue: '')
63 late String stateRaw;
64
65 TradeState get state => TradeState.deserialize(raw: stateRaw);
@@ -70,7 +70,7 @@ class Trade extends HiveObject {
70 @HiveField(6)
71 DateTime? expiredAt;
72
73 - @HiveField(7)
73 + @HiveField(7, defaultValue: '')
74 String amount;
75
76 @HiveField(8)