Initialize wallet directly from constructor argument [skip ci]

OmarHatem committed Dec 1, 2022 at 21:33 UTC 914fffe51cdec4ba880032dd53cfe925328daefa
1 file changed +9 -9
lib/view_model/settings/other_settings_view_model.dart
+9 -9
@@ -15,18 +15,17 @@ part 'other_settings_view_model.g.dart';
15 class OtherSettingsViewModel = OtherSettingsViewModelBase with _$OtherSettingsViewModel;
16
17 abstract class OtherSettingsViewModelBase with Store {
18 - OtherSettingsViewModelBase(
19 - this._settingsStore, WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet)
20 - : walletType = wallet.type,
21 - _wallet = wallet,
18 + OtherSettingsViewModelBase(this._settingsStore, this._wallet)
19 + : walletType = _wallet.type,
20 currentVersion = '' {
23 - PackageInfo.fromPlatform().then((PackageInfo packageInfo) => currentVersion = packageInfo.version);
21 + PackageInfo.fromPlatform()
22 + .then((PackageInfo packageInfo) => currentVersion = packageInfo.version);
23
25 - final priority = _settingsStore.priority[wallet.type];
26 - final priorities = priorityForWalletType(wallet.type);
24 + final priority = _settingsStore.priority[_wallet.type];
25 + final priorities = priorityForWalletType(_wallet.type);
26
27 if (!priorities.contains(priority)) {
29 - _settingsStore.priority[wallet.type] = priorities.first;
28 + _settingsStore.priority[_wallet.type] = priorities.first;
29 }
30 }
31
@@ -60,5 +59,6 @@ abstract class OtherSettingsViewModelBase with Store {
59 return priority.toString();
60 }
61
63 - void onDisplayPrioritySelected(TransactionPriority priority) => _settingsStore.priority[_wallet.type] = priority;
62 + void onDisplayPrioritySelected(TransactionPriority priority) =>
63 + _settingsStore.priority[_wallet.type] = priority;
64 }