mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 464 forks source link

Result return nothing for a good QR-Code image #251

Closed astrO1 closed 4 years ago

astrO1 commented 4 years ago

I'm trying to get the result from a QR-CODE but the code returns nothing. What I'm doing wrong?

iniScanner() async {
    try {
      var options = ScanOptions(
        useCamera: 1,
        strings: {
          "cancel": "Cancelar",
          "flash_on": 'Ligar flash',
          "flash_off": 'Desligar flash',
        },
      );

      var result = await BarcodeScanner.scan(options: options).then((value) {
        print(value);
      });
      print(result.type); // The result type (barcode, cancelled, failed)
      print(result.rawContent); // The barcode content
      print(result.format); // The barcode format (as enum)
      print(result.formatNote); // If

    } on PlatformException catch (e) {
      var result = ScanResult(
        type: ResultType.Error,
        format: BarcodeFormat.unknown,
      );
      if (e.code == BarcodeScanner.cameraAccessDenied) {
        setState(() {
          result.rawContent = 'The user did not grant the camera permission!';
        });
      } else {
        result.rawContent = 'Unknown error: $e';
      }
    }
  }

This is my code I try everything to get the result and nothing comes.

I'm using this website, for QR-CODE generator https://br.qr-code-generator.com/

And how I remove the title bar?

nicolasvac commented 4 years ago

I'm having the same problem

@devtronic any idea ? This is actually blocking our APP from be released, as we use QR-Codes to configure the Apps.

astrO1 commented 4 years ago

I resolve this @nicolasvac, what I did was make a new project from the latest Flutter release, and when I install the package it worked.

I think is something about the Kotlin version.