1- import 'dart:async' ;
2-
31import 'package:decimal/decimal.dart' ;
42import 'package:flutter/material.dart' ;
53import 'package:flutter_riverpod/flutter_riverpod.dart' ;
@@ -127,7 +125,8 @@ bool hasShopInBitWalletForTicker({
127125 return wallets.wallets.any ((e) => e.info.coin == coin);
128126}
129127
130- void _pushShopInBitSendFrom ({
128+ // Pushes the send-from view and awaits it.
129+ Future <void > _pushShopInBitSendFrom ({
131130 required BuildContext context,
132131 required CryptoCurrency coin,
133132 required Amount ? amount,
@@ -136,26 +135,24 @@ void _pushShopInBitSendFrom({
136135 EthContract ? tokenContract,
137136 bool popDesktopBeforeShow = false ,
138137 String ? routeOnSuccessName,
139- }) {
138+ }) async {
140139 if (Util .isDesktop) {
141140 if (popDesktopBeforeShow) {
142141 Navigator .of (context, rootNavigator: true ).pop ();
143142 }
144- unawaited (
145- showDialog <void >(
146- context: context,
147- builder: (_) => ShopInBitSendFromView (
148- coin: coin,
149- amount: amount,
150- address: address,
151- model: model,
152- shouldPopRoot: true ,
153- tokenContract: tokenContract,
154- ),
143+ await showDialog <void >(
144+ context: context,
145+ builder: (_) => ShopInBitSendFromView (
146+ coin: coin,
147+ amount: amount,
148+ address: address,
149+ model: model,
150+ shouldPopRoot: true ,
151+ tokenContract: tokenContract,
155152 ),
156153 );
157154 } else {
158- Navigator .of (context).push (
155+ await Navigator .of (context).push (
159156 RouteGenerator .getRoute <dynamic >(
160157 shouldUseMaterialRoute: RouteGenerator .useMaterialPageRoute,
161158 builder: (_) => ShopInBitSendFromView (
@@ -172,11 +169,8 @@ void _pushShopInBitSendFrom({
172169 }
173170}
174171
175- // Tries to launch the in-wallet send flow for [ticker]/[address]. Returns
176- // true when navigation happened. Returns false when no compatible wallet
177- // or token contract was found, leaving the caller to handle the
178- // "pay externally" path (flushbar, status change, etc).
179- bool tryNavigateToShopInBitWalletSend ({
172+ // Tries to launch the in-wallet send flow for [ticker]/[address].
173+ Future <bool > tryNavigateToShopInBitWalletSend ({
180174 required WidgetRef ref,
181175 required BuildContext context,
182176 required String ticker,
@@ -186,12 +180,12 @@ bool tryNavigateToShopInBitWalletSend({
186180 required ShopInBitOrderModel model,
187181 bool popDesktopBeforeShow = false ,
188182 String ? routeOnSuccessName,
189- }) {
183+ }) async {
190184 if (address.isEmpty) return false ;
191185
192186 final coin = AppConfig .getCryptoCurrencyForTicker (ticker);
193187 if (coin != null ) {
194- _pushShopInBitSendFrom (
188+ await _pushShopInBitSendFrom (
195189 context: context,
196190 coin: coin,
197191 amount: amount,
@@ -211,7 +205,7 @@ bool tryNavigateToShopInBitWalletSend({
211205 if (tokenContract != null ) {
212206 final ethCoin = AppConfig .getCryptoCurrencyForTicker ("ETH" );
213207 if (ethCoin != null ) {
214- _pushShopInBitSendFrom (
208+ await _pushShopInBitSendFrom (
215209 context: context,
216210 coin: ethCoin,
217211 amount: amount,
0 commit comments