Skip to content

Commit

Permalink
fix: optional cast error
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-CStack committed Dec 18, 2024
1 parent ba1ab97 commit c4b203f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/wallets/wallet/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,9 @@ abstract class Wallet<T extends CryptoCurrency> {
}

void _fireRefreshPercentChange(double percent) {
(this as ElectrumXInterface?)?.refreshingPercent = percent;
if (this is ElectrumXInterface) {
(this as ElectrumXInterface?)?.refreshingPercent = percent;
}
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(percent, walletId));
}

Expand Down

0 comments on commit c4b203f

Please sign in to comment.