fix: optional cast error

This commit is contained in:
julian 2024-12-17 19:23:56 -06:00 committed by julian-CStack
parent ba1ab977d6
commit 4fc2a7acfa
2 changed files with 9 additions and 5 deletions

View file

@ -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;
}

View file

@ -565,7 +565,9 @@ abstract class Wallet<T extends CryptoCurrency> {
}
void _fireRefreshPercentChange(double percent) {
if (this is ElectrumXInterface) {
(this as ElectrumXInterface?)?.refreshingPercent = percent;
}
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(percent, walletId));
}