From ec547449d30f38295bde0852c0f29500a04cbea4 Mon Sep 17 00:00:00 2001 From: Restioson Date: Mon, 4 Sep 2023 18:31:23 +0200 Subject: [PATCH] fix: avoid using BuildContext across async gap --- mobile/lib/features/wallet/share_invoice_screen.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/lib/features/wallet/share_invoice_screen.dart b/mobile/lib/features/wallet/share_invoice_screen.dart index 3d3d8852e..cf5844ab0 100644 --- a/mobile/lib/features/wallet/share_invoice_screen.dart +++ b/mobile/lib/features/wallet/share_invoice_screen.dart @@ -130,13 +130,14 @@ class _ShareInvoiceScreenState extends State { }); final router = GoRouter.of(context); + final messenger = ScaffoldMessenger.of(context); try { await payInvoiceWithFaucet(widget.invoice.rawInvoice); // Pop both create invoice screen and share invoice screen router.pop(); router.pop(); } catch (error) { - showSnackBar(ScaffoldMessenger.of(context), error.toString()); + showSnackBar(messenger, error.toString()); } finally { setState(() { _isPayInvoiceButtonDisabled = false;