fix null check when user exits out of qr code scanner (#2002)

This commit is contained in:
cyan 2025-02-05 02:40:06 +01:00 committed by GitHub
parent e88b6b2bcf
commit 1dc7f9309a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 4 deletions

View file

@ -12,7 +12,7 @@ import 'package:flutter/scheduler.dart';
var isQrScannerShown = false;
Future<String> presentQRScanner(BuildContext context) async {
Future<String?> presentQRScanner(BuildContext context) async {
isQrScannerShown = true;
try {
final result = await Navigator.of(context).push<String>(
@ -23,7 +23,7 @@ Future<String> presentQRScanner(BuildContext context) async {
),
);
isQrScannerShown = false;
return result!;
return result;
} catch (e) {
isQrScannerShown = false;
rethrow;