Fix parsing .yml files to nodes (#543)

Omar Hatem committed Oct 20, 2022 at 00:23 UTC e011ab3e88f787b578492ffa97d7cad2049ea472
2 files changed +7 -8
cw_core/lib/node.dart
+3 -4
@@ -29,10 +29,9 @@ class Node extends HiveObject with Keyable {
29
30 Node.fromMap(Map<String, Object?> map)
31 : uriRaw = map['uri'] as String? ?? '',
32 - login = map['login'] as String,
33 - password = map['password'] as String,
34 - typeRaw = map['typeRaw'] as int,
35 - useSSL = map['useSSL'] as bool;
32 + login = map['login'] as String?,
33 + password = map['password'] as String?,
34 + useSSL = map['useSSL'] as bool?;
35
36 static const typeId = 1;
37 static const boxName = 'Nodes';
lib/entities/node_list.dart
+4 -4
@@ -11,7 +11,7 @@ Future<List<Node>> loadDefaultNodes() async {
11
12 for (final raw in loadedNodes) {
13 if (raw is Map) {
14 - final node = Node.fromMap(raw as Map<String, Object>);
14 + final node = Node.fromMap(Map<String, Object>.from(raw));
15 node.type = WalletType.monero;
16 nodes.add(node);
17 }
@@ -28,7 +28,7 @@ Future<List<Node>> loadBitcoinElectrumServerList() async {
28
29 for (final raw in loadedServerList) {
30 if (raw is Map) {
31 - final node = Node.fromMap(raw as Map<String, Object>);
31 + final node = Node.fromMap(Map<String, Object>.from(raw));
32 node.type = WalletType.bitcoin;
33 serverList.add(node);
34 }
@@ -45,7 +45,7 @@ Future<List<Node>> loadLitecoinElectrumServerList() async {
45
46 for (final raw in loadedServerList) {
47 if (raw is Map) {
48 - final node = Node.fromMap(raw as Map<String, Object>);
48 + final node = Node.fromMap(Map<String, Object>.from(raw));
49 node.type = WalletType.litecoin;
50 serverList.add(node);
51 }
@@ -61,7 +61,7 @@ Future<List<Node>> loadDefaultHavenNodes() async {
61
62 for (final raw in loadedNodes) {
63 if (raw is Map) {
64 - final node = Node.fromMap(raw as Map<String, Object>);
64 + final node = Node.fromMap(Map<String, Object>.from(raw));
65 node.type = WalletType.haven;
66 nodes.add(node);
67 }