refactoring mapFomString method
Serhii committed
Nov 23, 2022 at 13:47 UTC
d7d3b78905849c9a0ba554940e349ddec7654e5f
3 files changed
+82
-140
cw_core/lib/crypto_currency.dart
+80
-138
@@ -9,12 +9,14 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
9
String title = '',
10
int raw = -1,
11
this.name,
12
+ this.fullName,
13
this.iconPath,
13
- this.tag,})
14
+ this.tag})
15
: super(title: title, raw: raw);
16
16
- final String? tag;
17
final String? name;
18
+ final String? tag;
19
+ final String? fullName;
20
final String? iconPath;
21
22
static const all = [
@@ -70,161 +72,101 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
72
CryptoCurrency.stx,
73
];
74
73
- static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', name: 'Monero', raw: 0);
74
- static const ada = CryptoCurrency(title: 'ADA', iconPath: 'assets/images/ada_icon.png', name: 'Cardano', raw: 1);
75
- static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',name: 'Bitcoin Cash', raw: 2);
76
- static const bnb = CryptoCurrency(title: 'BNB', iconPath: 'assets/images/bnb_icon.png', tag: 'BSC', name: 'Binance Coin', raw: 3);
77
- static const btc = CryptoCurrency(title: 'BTC', iconPath: 'assets/images/btc.png', name: 'Bitcoin', raw: 4);
78
- static const dai = CryptoCurrency(title: 'DAI', iconPath: 'assets/images/dai_icon.png', tag: 'ETH', name: 'Dai', raw: 5);
79
- static const dash = CryptoCurrency(title: 'DASH', iconPath: 'assets/images/dash_icon.png', name: 'Dash', raw: 6);
80
- static const eos = CryptoCurrency(title: 'EOS', iconPath: 'assets/images/eos_icon.png', name: 'EOS', raw: 7);
81
- static const eth = CryptoCurrency(title: 'ETH', iconPath: 'assets/images/eth_icon.png', name: 'Ethereum', raw: 8);
82
- static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', name: 'Litecoin', raw: 9);
83
- static const nano = CryptoCurrency(title: 'NANO', raw: 10);
84
- static const trx = CryptoCurrency(title: 'TRX', iconPath: 'assets/images/trx_icon.png', name: 'TRON', raw: 11);
85
- static const usdt = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdt_icon.png', tag: 'OMNI', name: 'USDT', raw: 12);
86
- static const usdterc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdterc20_icon.png', tag: 'ETH', name: 'USDT', raw: 13);
87
- static const xlm = CryptoCurrency(title: 'XLM', iconPath: 'assets/images/xlm_icon.png', name: 'Stellar', raw: 14);
88
- static const xrp = CryptoCurrency(title: 'XRP', iconPath: 'assets/images/xrp_icon.png', name: 'Ripple', raw: 15);
89
- static const xhv = CryptoCurrency(title: 'XHV', iconPath: 'assets/images/xhv_logo.png', name: 'Haven Protocol', raw: 16);
75
+ static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', fullName: 'Monero', raw: 0, name: 'xmr');
76
+ static const ada = CryptoCurrency(title: 'ADA', iconPath: 'assets/images/ada_icon.png', fullName: 'Cardano', raw: 1, name: 'ada');
77
+ static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',fullName: 'Bitcoin Cash', raw: 2, name: 'bch');
78
+ static const bnb = CryptoCurrency(title: 'BNB', iconPath: 'assets/images/bnb_icon.png', tag: 'BSC', fullName: 'Binance Coin', raw: 3, name: 'bnb');
79
+ static const btc = CryptoCurrency(title: 'BTC', iconPath: 'assets/images/btc.png', fullName: 'Bitcoin', raw: 4, name: 'btc');
80
+ static const dai = CryptoCurrency(title: 'DAI', iconPath: 'assets/images/dai_icon.png', tag: 'ETH', fullName: 'Dai', raw: 5, name: 'dai');
81
+ static const dash = CryptoCurrency(title: 'DASH', iconPath: 'assets/images/dash_icon.png', fullName: 'Dash', raw: 6, name: 'dash');
82
+ static const eos = CryptoCurrency(title: 'EOS', iconPath: 'assets/images/eos_icon.png', fullName: 'EOS', raw: 7, name: 'eos');
83
+ static const eth = CryptoCurrency(title: 'ETH', iconPath: 'assets/images/eth_icon.png', fullName: 'Ethereum', raw: 8, name: 'eth');
84
+ static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', fullName: 'Litecoin', raw: 9, name: 'ltc');
85
+ static const nano = CryptoCurrency(title: 'NANO', raw: 10, name: 'nano');
86
+ static const trx = CryptoCurrency(title: 'TRX', iconPath: 'assets/images/trx_icon.png', fullName: 'TRON', raw: 11, name: 'trx');
87
+ static const usdt = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdt_icon.png', tag: 'OMNI', fullName: 'USDT', raw: 12, name: 'usdt');
88
+ static const usdterc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdterc20_icon.png', tag: 'ETH', fullName: 'USDT', raw: 13, name: 'usdterc20');
89
+ static const xlm = CryptoCurrency(title: 'XLM', iconPath: 'assets/images/xlm_icon.png', fullName: 'Stellar', raw: 14, name: 'xlm');
90
+ static const xrp = CryptoCurrency(title: 'XRP', iconPath: 'assets/images/xrp_icon.png', fullName: 'Ripple', raw: 15, name: 'xrp');
91
+ static const xhv = CryptoCurrency(title: 'XHV', iconPath: 'assets/images/xhv_logo.png', fullName: 'Haven Protocol', raw: 16, name: 'xhv');
92
91
- static const xag = CryptoCurrency(title: 'XAG', tag: 'XHV', raw: 17);
92
- static const xau = CryptoCurrency(title: 'XAU', tag: 'XHV', raw: 18);
93
- static const xaud = CryptoCurrency(title: 'XAUD', tag: 'XHV', raw: 19);
94
- static const xbtc = CryptoCurrency(title: 'XBTC', tag: 'XHV', raw: 20);
95
- static const xcad = CryptoCurrency(title: 'XCAD', tag: 'XHV', raw: 21);
96
- static const xchf = CryptoCurrency(title: 'XCHF', tag: 'XHV', raw: 22);
97
- static const xcny = CryptoCurrency(title: 'XCNY', tag: 'XHV', raw: 23);
98
- static const xeur = CryptoCurrency(title: 'XEUR', tag: 'XHV', raw: 24);
99
- static const xgbp = CryptoCurrency(title: 'XGBP', tag: 'XHV', raw: 25);
100
- static const xjpy = CryptoCurrency(title: 'XJPY', tag: 'XHV', raw: 26);
101
- static const xnok = CryptoCurrency(title: 'XNOK', tag: 'XHV', raw: 27);
102
- static const xnzd = CryptoCurrency(title: 'XNZD', tag: 'XHV', raw: 28);
103
- static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29);
93
+ static const xag = CryptoCurrency(title: 'XAG', tag: 'XHV', raw: 17, name: 'xag');
94
+ static const xau = CryptoCurrency(title: 'XAU', tag: 'XHV', raw: 18, name: 'xau');
95
+ static const xaud = CryptoCurrency(title: 'XAUD', tag: 'XHV', raw: 19, name: 'xaud');
96
+ static const xbtc = CryptoCurrency(title: 'XBTC', tag: 'XHV', raw: 20, name: 'xbtc');
97
+ static const xcad = CryptoCurrency(title: 'XCAD', tag: 'XHV', raw: 21, name: 'xcad');
98
+ static const xchf = CryptoCurrency(title: 'XCHF', tag: 'XHV', raw: 22, name: 'xchf');
99
+ static const xcny = CryptoCurrency(title: 'XCNY', tag: 'XHV', raw: 23, name: 'xcny');
100
+ static const xeur = CryptoCurrency(title: 'XEUR', tag: 'XHV', raw: 24, name: 'xeur');
101
+ static const xgbp = CryptoCurrency(title: 'XGBP', tag: 'XHV', raw: 25, name: 'xgbp');
102
+ static const xjpy = CryptoCurrency(title: 'XJPY', tag: 'XHV', raw: 26, name: 'xjpy');
103
+ static const xnok = CryptoCurrency(title: 'XNOK', tag: 'XHV', raw: 27, name: 'xnok');
104
+ static const xnzd = CryptoCurrency(title: 'XNZD', tag: 'XHV', raw: 28, name: 'xnzd');
105
+ static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29, name: 'xusd');
106
105
- static const ape = CryptoCurrency(title: 'APE', iconPath: 'assets/images/ape_icon.png', tag: 'ETH', raw: 30);
106
- static const avaxc = CryptoCurrency(title: 'AVAX', iconPath: 'assets/images/avaxc_icon.png', tag: 'C-CHAIN', raw: 31);
107
- static const btt = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/btt_icon.png', raw: 32);
108
- static const bttbsc = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/bttbsc_icon.png', tag: 'BSC', raw: 33);
109
- static const doge = CryptoCurrency(title: 'DOGE', iconPath: 'assets/images/doge_icon.png', raw: 34);
110
- static const firo = CryptoCurrency(title: 'FIRO', iconPath: 'assets/images/firo_icon.png', raw: 35);
111
- static const usdttrc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdttrc20_icon.png', tag: 'TRX', raw: 36);
112
- static const hbar = CryptoCurrency(title: 'HBAR', iconPath: 'assets/images/hbar_icon.png', raw: 37);
113
- static const sc = CryptoCurrency(title: 'SC', iconPath: 'assets/images/sc_icon.png', raw: 38);
114
- static const sol = CryptoCurrency(title: 'SOL', iconPath: 'assets/images/sol_icon.png', raw: 39);
115
- static const usdc = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'ETH', raw: 40);
116
- static const usdcsol = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdcsol_icon.png', tag: 'SOL', raw: 41);
117
- static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', name: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 42);
118
- static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', name: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 43);
119
- static const zen = CryptoCurrency(title: 'ZEN', iconPath: 'assets/images/zen_icon.png', raw: 44);
120
- static const xvg = CryptoCurrency(title: 'XVG', name: 'Verge', iconPath: 'assets/images/xvg_icon.png', raw: 45);
107
+ static const ape = CryptoCurrency(title: 'APE', iconPath: 'assets/images/ape_icon.png', tag: 'ETH', raw: 30, name: 'ape');
108
+ static const avaxc = CryptoCurrency(title: 'AVAX', iconPath: 'assets/images/avaxc_icon.png', tag: 'C-CHAIN', raw: 31, name: 'avaxc');
109
+ static const btt = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/btt_icon.png', raw: 32, name: 'btt');
110
+ static const bttbsc = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/bttbsc_icon.png', tag: 'BSC', raw: 33, name: 'bttbsc');
111
+ static const doge = CryptoCurrency(title: 'DOGE', iconPath: 'assets/images/doge_icon.png', raw: 34, name: 'doge');
112
+ static const firo = CryptoCurrency(title: 'FIRO', iconPath: 'assets/images/firo_icon.png', raw: 35, name: 'firo');
113
+ static const usdttrc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdttrc20_icon.png', tag: 'TRX', raw: 36, name: 'usdttrc20');
114
+ static const hbar = CryptoCurrency(title: 'HBAR', iconPath: 'assets/images/hbar_icon.png', raw: 37, name: 'hbar');
115
+ static const sc = CryptoCurrency(title: 'SC', iconPath: 'assets/images/sc_icon.png', raw: 38, name: 'sc');
116
+ static const sol = CryptoCurrency(title: 'SOL', iconPath: 'assets/images/sol_icon.png', raw: 39, name: 'sol');
117
+ static const usdc = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'ETH', raw: 40, name: 'usdc');
118
+ static const usdcsol = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdcsol_icon.png', tag: 'SOL', raw: 41, name: 'usdcsol');
119
+ static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', fullName: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 42, name: 'zaddr');
120
+ static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', fullName: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 43, name: 'zec');
121
+ static const zen = CryptoCurrency(title: 'ZEN', iconPath: 'assets/images/zen_icon.png', raw: 44, name: 'zen');
122
+ static const xvg = CryptoCurrency(title: 'XVG', fullName: 'Verge', iconPath: 'assets/images/xvg_icon.png', raw: 45, name: 'xvg');
123
122
- static const usdcpoly = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'POLY', raw: 46);
123
- static const dcr = CryptoCurrency(title: 'DCR', iconPath: 'assets/images/dcr_icon.png', raw: 47);
124
- static const husd = CryptoCurrency(title: 'HUSD', iconPath: 'assets/images/husd_icon.png', tag: 'ETH', raw: 48);
125
- static const kmd = CryptoCurrency(title: 'KMD', iconPath: 'assets/images/kmd_icon.png', raw: 49);
126
- static const mana = CryptoCurrency(title: 'MANA', iconPath: 'assets/images/mana_icon.png', tag: 'ETH', raw: 50);
127
- static const maticpoly = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'POLY', raw: 51);
128
- static const matic = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'ETH', raw: 52);
129
- static const mkr = CryptoCurrency(title: 'MKR', iconPath: 'assets/images/mkr_icon.png', tag: 'ETH', raw: 53);
130
- static const near = CryptoCurrency(title: 'NEAR', iconPath: 'assets/images/near_icon.png', raw: 54);
131
- static const oxt = CryptoCurrency(title: 'OXT', iconPath: 'assets/images/oxt_icon.png', tag: 'ETH', raw: 55);
132
- static const paxg = CryptoCurrency(title: 'PAXG', iconPath: 'assets/images/paxg_icon.png', tag: 'ETH', raw: 56);
133
- static const pivx = CryptoCurrency(title: 'PIVX', iconPath: 'assets/images/pivx_icon.png', raw: 57);
134
- static const rune = CryptoCurrency(title: 'RUNE', iconPath: 'assets/images/rune_icon.png', raw: 58);
135
- static const rvn = CryptoCurrency(title: 'RVN', iconPath: 'assets/images/rvn_icon.png', raw: 59);
136
- static const scrt = CryptoCurrency(title: 'SCRT', iconPath: 'assets/images/scrt_icon.png', raw: 60);
137
- static const uni = CryptoCurrency(title: 'UNI', iconPath: 'assets/images/uni_icon.png', tag: 'ETH', raw: 61);
138
- static const stx = CryptoCurrency(title: 'STX', iconPath: 'assets/images/stx_icon.png', raw: 62);
124
+ static const usdcpoly = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'POLY', raw: 46, name: 'usdcpoly');
125
+ static const dcr = CryptoCurrency(title: 'DCR', iconPath: 'assets/images/dcr_icon.png', raw: 47, name: 'dcr');
126
+ static const husd = CryptoCurrency(title: 'HUSD', iconPath: 'assets/images/husd_icon.png', tag: 'ETH', raw: 48, name: 'husd');
127
+ static const kmd = CryptoCurrency(title: 'KMD', iconPath: 'assets/images/kmd_icon.png', raw: 49, name: 'kmd');
128
+ static const mana = CryptoCurrency(title: 'MANA', iconPath: 'assets/images/mana_icon.png', tag: 'ETH', raw: 50, name: 'mana');
129
+ static const maticpoly = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'POLY', raw: 51, name: 'maticpoly');
130
+ static const matic = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'ETH', raw: 52, name: 'matic');
131
+ static const mkr = CryptoCurrency(title: 'MKR', iconPath: 'assets/images/mkr_icon.png', tag: 'ETH', raw: 53, name: 'mkr');
132
+ static const near = CryptoCurrency(title: 'NEAR', iconPath: 'assets/images/near_icon.png', raw: 54, name: 'near');
133
+ static const oxt = CryptoCurrency(title: 'OXT', iconPath: 'assets/images/oxt_icon.png', tag: 'ETH', raw: 55, name: 'oxt');
134
+ static const paxg = CryptoCurrency(title: 'PAXG', iconPath: 'assets/images/paxg_icon.png', tag: 'ETH', raw: 56, name: 'paxg');
135
+ static const pivx = CryptoCurrency(title: 'PIVX', iconPath: 'assets/images/pivx_icon.png', raw: 57, name: 'pivx');
136
+ static const rune = CryptoCurrency(title: 'RUNE', iconPath: 'assets/images/rune_icon.png', raw: 58, name: 'rune');
137
+ static const rvn = CryptoCurrency(title: 'RVN', iconPath: 'assets/images/rvn_icon.png', raw: 59, name: 'rvn');
138
+ static const scrt = CryptoCurrency(title: 'SCRT', iconPath: 'assets/images/scrt_icon.png', raw: 60, name: 'scrt');
139
+ static const uni = CryptoCurrency(title: 'UNI', iconPath: 'assets/images/uni_icon.png', tag: 'ETH', raw: 61, name: 'uni');
140
+ static const stx = CryptoCurrency(title: 'STX', iconPath: 'assets/images/stx_icon.png', raw: 62, name: 'stx');
141
140
- static Map<int, CryptoCurrency> rawCurrencyMap =
142
+ static final Map<int, CryptoCurrency> _rawCurrencyMap =
143
all.fold<Map<int, CryptoCurrency>>(<int, CryptoCurrency>{}, (acc, item) {
144
acc.addAll({item.raw: item});
145
return acc;
146
});
147
146
- static const mapFromString = {
147
- 'xmr': CryptoCurrency.xmr,
148
- 'ada': CryptoCurrency.ada,
149
- 'bch': CryptoCurrency.bch,
150
- 'bnb': CryptoCurrency.bnb,
151
- 'btc': CryptoCurrency.btc,
152
- 'dai': CryptoCurrency.dai,
153
- 'dash': CryptoCurrency.dash,
154
- 'eos': CryptoCurrency.eos,
155
- 'eth': CryptoCurrency.eth,
156
- 'ltc': CryptoCurrency.ltc,
157
- 'nano': CryptoCurrency.nano,
158
- 'trx': CryptoCurrency.trx,
159
- 'usdt': CryptoCurrency.usdt,
160
- 'usdterc20': CryptoCurrency.usdterc20,
161
- 'xlm': CryptoCurrency.xlm,
162
- 'xrp': CryptoCurrency.xrp,
163
- 'xhv': CryptoCurrency.xhv,
164
- 'xag': CryptoCurrency.xag,
165
- 'xau': CryptoCurrency.xau,
166
- 'xaud': CryptoCurrency.xaud,
167
- 'xbtc': CryptoCurrency.xbtc,
168
- 'xcad': CryptoCurrency.xcad,
169
- 'xchf': CryptoCurrency.xchf,
170
- 'xcny': CryptoCurrency.xcny,
171
- 'xeur': CryptoCurrency.xeur,
172
- 'xgbp': CryptoCurrency.xgbp,
173
- 'xjpy': CryptoCurrency.xjpy,
174
- 'xnok': CryptoCurrency.xnok,
175
- 'xnzd': CryptoCurrency.xnzd,
176
- 'xusd': CryptoCurrency.xusd,
177
- 'ape': CryptoCurrency.ape,
178
- 'avaxc': CryptoCurrency.avaxc,
179
- 'btt': CryptoCurrency.btt,
180
- 'bttbsc': CryptoCurrency.bttbsc,
181
- 'doge': CryptoCurrency.doge,
182
- 'firo': CryptoCurrency.firo,
183
- 'usdttrc20': CryptoCurrency.usdttrc20,
184
- 'hbar': CryptoCurrency.hbar,
185
- 'sc': CryptoCurrency.sc,
186
- 'sol': CryptoCurrency.sol,
187
- 'usdc': CryptoCurrency.usdc,
188
- 'usdcsol': CryptoCurrency.usdcsol,
189
- 'zaddr': CryptoCurrency.zaddr,
190
- 'zec': CryptoCurrency.zec,
191
- 'zen': CryptoCurrency.zen,
192
- 'xvg': CryptoCurrency.xvg,
193
- 'usdcpoly': CryptoCurrency.usdcpoly,
194
- 'dcr': CryptoCurrency.dcr,
195
- 'husd': CryptoCurrency.husd,
196
- 'kmd': CryptoCurrency.kmd,
197
- 'mana': CryptoCurrency.mana,
198
- 'maticpoly': CryptoCurrency.maticpoly,
199
- 'matic': CryptoCurrency.matic,
200
- 'mkr': CryptoCurrency.mkr,
201
- 'near': CryptoCurrency.near,
202
- 'oxt': CryptoCurrency.oxt,
203
- 'paxg': CryptoCurrency.paxg,
204
- 'pivx': CryptoCurrency.pivx,
205
- 'rune': CryptoCurrency.rune,
206
- 'rvn': CryptoCurrency.rvn,
207
- 'scrt': CryptoCurrency.scrt,
208
- 'uni': CryptoCurrency.uni,
209
- 'stx': CryptoCurrency.stx
210
- };
148
+ static final Map<String?, CryptoCurrency> _nameCurrencyMap =
149
+ all.fold<Map<String?, CryptoCurrency>>(<String?, CryptoCurrency>{}, (acc, item) {
150
+ acc.addAll({item.name: item});
151
+ return acc;
152
+ });
153
154
static CryptoCurrency deserialize({required int raw}) {
155
214
- if (CryptoCurrency.rawCurrencyMap[raw] == null) {
156
+ if (CryptoCurrency._rawCurrencyMap[raw] == null) {
157
final s = 'Unexpected token: $raw for CryptoCurrency deserialize';
158
throw ArgumentError.value(raw, 'raw', s);
159
}
218
- return CryptoCurrency.rawCurrencyMap[raw]!;
160
+ return CryptoCurrency._rawCurrencyMap[raw]!;
161
}
162
221
- static CryptoCurrency fromString(String raw) {
163
+ static CryptoCurrency fromString(String name) {
164
223
- if (CryptoCurrency.mapFromString[raw.toLowerCase()] == null) {
224
- final s = 'Unexpected token: $raw for CryptoCurrency fromString';
225
- throw ArgumentError.value(raw, 'raw', s);
165
+ if (CryptoCurrency._nameCurrencyMap[name.toLowerCase()] == null) {
166
+ final s = 'Unexpected token: $name for CryptoCurrency fromString';
167
+ throw ArgumentError.value(name, 'name', s);
168
}
227
- return CryptoCurrency.mapFromString[raw.toLowerCase()]!;
169
+ return CryptoCurrency._nameCurrencyMap[name.toLowerCase()]!;
170
}
171
172
@override
lib/src/screens/exchange/widgets/currency_picker.dart
+1
-1
@@ -56,7 +56,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
56
.where((element) =>
57
(element.title != null ? element.title.toLowerCase().contains(subString.toLowerCase()) : false) ||
58
(element.tag != null ? element.tag!.toLowerCase().contains(subString.toLowerCase()) : false) ||
59
- (element.name != null ? element.name!.toLowerCase().contains(subString.toLowerCase()) : false))
59
+ (element.fullName != null ? element.fullName!.toLowerCase().contains(subString.toLowerCase()) : false))
60
.toList();
61
return;
62
}
lib/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart
+1
-1
@@ -30,7 +30,7 @@ abstract class WalletAddressEditOrCreateViewModelBase with Store {
30
{required WalletBase wallet, dynamic item})
31
: isEdit = item != null,
32
state = AddressEditOrCreateStateInitial(),
33
- label = item?.name as String? ?? '',
33
+ label = item?.fullName as String? ?? '',
34
_item = item,
35
_wallet = wallet;
36