Remove Errorhandling from scanner
parent
afb63adb5c
commit
88ec309f55
|
@ -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,15 +39,11 @@ 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);
|
||||
}
|
||||
final List<Barcode> barcodes = capture.barcodes;
|
||||
for (final barcode in barcodes) {
|
||||
if (barcode.rawValue != null) {
|
||||
return handleSucces(barcode.rawValue);
|
||||
}
|
||||
} finally {
|
||||
handleError();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue