Remove Errorhandling from scanner

main
Kai Mannweiler 2023-02-27 20:36:59 +01:00
parent afb63adb5c
commit 88ec309f55
1 changed files with 4 additions and 20 deletions

View File

@ -19,18 +19,6 @@ class MyScanner extends StatefulWidget {
class MyScannerState extends State<MyScanner> {
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<String, dynamic> json = stringToJSON(qrText);
@ -51,16 +39,12 @@ class MyScannerState extends State<MyScanner> {
}
void onDetect(capture) {
try {
final List<Barcode> barcodes = capture.barcodes;
for (final barcode in barcodes) {
if (barcode.rawValue != null) {
return handleSucces(barcode.rawValue);
}
}
} finally {
handleError();
}
}
@override