Skip to content

Commit

Permalink
fix: avoid using BuildContext across async gap
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Sep 4, 2023
1 parent 1ba61d8 commit ec54744
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mobile/lib/features/wallet/share_invoice_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ class _ShareInvoiceScreenState extends State<ShareInvoiceScreen> {
});

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;
Expand Down

0 comments on commit ec54744

Please sign in to comment.