mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:38:56 +03:30
beta commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import 'package:barcode_scan2/platform_wrapper.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
Future<String> scan() async {
|
||||
try {
|
||||
var barcode = await BarcodeScanner.scan();
|
||||
if (barcode.type.name == 'Cancelled') {
|
||||
return 'cancel';
|
||||
} else if (barcode.type.name == 'Failed') {
|
||||
return 'error';
|
||||
}
|
||||
try {
|
||||
var id = barcode.rawContent.contains('www.cssd-doc.com')
|
||||
? barcode.rawContent.split('/')[5]
|
||||
: barcode.rawContent;
|
||||
|
||||
return id;
|
||||
} catch (_) {
|
||||
return 'null';
|
||||
}
|
||||
} on PlatformException catch (_) {
|
||||
return 'access';
|
||||
} catch (_) {
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user