scanQR method

Future<void> scanQR()

Scans the QR code.

Implementation

Future<void> scanQR() async {
  String barcodeScanRes;
  try {
    barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
        "#ff6666", "Cancel", false, ScanMode.QR);
    debugPrint(barcodeScanRes);
  } on PlatformException {
    barcodeScanRes = 'Failed to get platform version.';
  }
  setState(() {
    isEditOrg = false;
  });
  if (!mounted) return;
  debugPrint("Scanned URL $barcodeScanRes");
  if (barcodeScanRes != "-1" && barcodeScanRes.isNotEmpty) {
    String result;
    result = barcodeScanRes;
    result = result.replaceAll("FETOSENSE:", "");
    result = result.replaceAll("fetosense:", "");

    String decoded = utf8.decode(base64.decode(result));

    debugPrint('decoded id is $decoded');
    updateOrg(decoded);
  }
}