onQrCreated method

void onQrCreated(
  1. QRViewController controller
)

Implementation

void onQrCreated(QRViewController controller) async {
  try {
    await ScreenBrightness.instance.setApplicationScreenBrightness(0.75);
    (this).qrViewController = controller;
    (this).qrViewController.resumeCamera();
    controller.scannedDataStream.listen((scanData) {
      if (result.isEmpty) {
        (this).qrViewController.pauseCamera();
        result = scanData.code ?? "";
        scan(result);
      }
    });
  } catch (e) {
    onError?.call("Camera gagal initialisasi");
  }
}