From 88ec309f555e6c12c02cde416212aa8889ff48ff Mon Sep 17 00:00:00 2001 From: "k.mannweiler" <2012491@stud.hs-mannheim.de> Date: Mon, 27 Feb 2023 20:36:59 +0100 Subject: [PATCH] Remove Errorhandling from scanner --- lib/widgets/scanner.dart | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/lib/widgets/scanner.dart b/lib/widgets/scanner.dart index a8b1b2b..f7a5089 100644 --- a/lib/widgets/scanner.dart +++ b/lib/widgets/scanner.dart @@ -19,18 +19,6 @@ class MyScanner extends StatefulWidget { class MyScannerState extends State { bool scanning = false; - void handleError() { - setState(() { - scanning = false; - AwesomeDialog( - context: context, - dialogType: DialogType.error, - title: 'Upss', - desc: 'Da muss etwas schiefgelaufen sein!', - ).show(); - }); - } - void handleSucces(String? rawValue) { String qrText = rawValue!; Map json = stringToJSON(qrText); @@ -51,15 +39,11 @@ class MyScannerState extends State { } void onDetect(capture) { - try { - final List barcodes = capture.barcodes; - for (final barcode in barcodes) { - if (barcode.rawValue != null) { - return handleSucces(barcode.rawValue); - } + final List barcodes = capture.barcodes; + for (final barcode in barcodes) { + if (barcode.rawValue != null) { + return handleSucces(barcode.rawValue); } - } finally { - handleError(); } }