diff --git a/lib/ui/views/transfer/layouts/components/transfer_confirm_sheet.dart b/lib/ui/views/transfer/layouts/components/transfer_confirm_sheet.dart index 65059d35b..5decab1c6 100755 --- a/lib/ui/views/transfer/layouts/components/transfer_confirm_sheet.dart +++ b/lib/ui/views/transfer/layouts/components/transfer_confirm_sheet.dart @@ -99,39 +99,47 @@ class _TransferConfirmSheetState extends ConsumerState duration: const Duration(milliseconds: 5000), icon: Symbols.info, ); - final transfer = ref.read(TransferFormProvider.transferForm); - if (transfer.transferType == TransferType.nft) { - final transactionMap = await sl - .get() - .getLastTransaction([event.transactionAddress!]); - final transaction = transactionMap[event.transactionAddress!]; - final tokenMap = await sl.get().getToken( - [ - transaction!.data!.ledger!.token!.transfers[0].tokenAddress!, - ], - ); - - final selectedAccount = await ref.read( - AccountProviders.selectedAccount.future, - ); - await selectedAccount!.removeftInfosOffChain( - tokenMap[transaction.data!.ledger!.token!.transfers[0].tokenAddress!]! - .id, - ); // TODO(reddwarf03): we should not interact directly with data source. Use Providers instead. (3) - - await ref.read(AccountProviders.selectedAccount.notifier).refreshNFTs(); - } + try { + final transfer = ref.read(TransferFormProvider.transferForm); + if (transfer.transferType == TransferType.nft) { + final transactionMap = await sl + .get() + .getLastTransaction([event.transactionAddress!]); + final transaction = transactionMap[event.transactionAddress!]; + final tokenMap = await sl.get().getToken( + [ + transaction!.data!.ledger!.token!.transfers[0].tokenAddress!, + ], + ); + + final selectedAccount = await ref.read( + AccountProviders.selectedAccount.future, + ); + + await selectedAccount!.removeftInfosOffChain( + tokenMap[transaction.data!.ledger!.token!.transfers[0].tokenAddress!]! + .id, + ); // TODO(reddwarf03): we should not interact directly with data source. Use Providers instead. (3) + + unawaited( + ref.read(AccountProviders.selectedAccount.notifier).refreshNFTs(), + ); + } - await ref - .read(AccountProviders.selectedAccount.notifier) - .refreshRecentTransactions(); - if (transfer.transferType == TransferType.token) { - await ref - .read(AccountProviders.selectedAccount.notifier) - .refreshFungibleTokens(); - } - if (mounted) { + unawaited( + ref + .read(AccountProviders.selectedAccount.notifier) + .refreshRecentTransactions(), + ); + if (transfer.transferType == TransferType.token) { + unawaited( + ref + .read(AccountProviders.selectedAccount.notifier) + .refreshFungibleTokens(), + ); + } + } finally { context.go(HomePage.routerPage); } }