scanQR method

Future<void> scanQR(
  1. String barcodeScanRes
)

Scans the QR code for the organization. barcodeScanRes is the scanned QR code result.

Implementation

Future<void> scanQR(String barcodeScanRes) async {
  setState(() {
    isEditOrg = false;
  });
  if (barcodeScanRes != "-1" && barcodeScanRes.isNotEmpty) {
    try {
      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);
    } on FormatException {
      ScaffoldMessenger.of(_scaffoldKey.currentState!.context)
          .showSnackBar(const SnackBar(
        content: Text('Invalid QR CODE'),
      ));
    }
  }
}