diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart index f8eb344a8..5b3a2eb07 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart @@ -234,10 +234,12 @@ class _WalletNetworkSettingsViewState _percent = 1; _blocksRemaining = 0; } else { - _percent = - (ref.read(pWallets).getWallet(widget.walletId) as ElectrumXInterface?) - ?.refreshingPercent ?? - 0; + final wallet = ref.read(pWallets).getWallet(widget.walletId); + if (wallet is ElectrumXInterface) { + _percent = wallet.refreshingPercent ?? 0; + } else { + _percent = 0; + } _blocksRemaining = -1; } diff --git a/lib/wallets/wallet/wallet.dart b/lib/wallets/wallet/wallet.dart index b0516b74e..4445ba7a9 100644 --- a/lib/wallets/wallet/wallet.dart +++ b/lib/wallets/wallet/wallet.dart @@ -565,7 +565,9 @@ abstract class Wallet { } void _fireRefreshPercentChange(double percent) { - (this as ElectrumXInterface?)?.refreshingPercent = percent; + if (this is ElectrumXInterface) { + (this as ElectrumXInterface?)?.refreshingPercent = percent; + } GlobalEventBus.instance.fire(RefreshPercentChangedEvent(percent, walletId)); }