Code Monkey home page Code Monkey logo

khoren93 / flutter_zxing Goto Github PK

View Code? Open in Web Editor NEW
92.0 5.0 52.0 9.12 MB

Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms

Home Page: https://pub.dev/packages/flutter_zxing

License: MIT License

Kotlin 0.82% Ruby 3.97% Swift 7.09% Objective-C 0.03% Dart 60.30% Shell 0.35% CMake 8.78% C++ 17.07% C 0.84% HTML 0.75%
barcode barcode-generator barcode-scanner flutter generator qr qrcode qrcode-generator qrcode-scanner scanner

flutter_zxing's Introduction

Hi there 👋

GitHub stats Most Used Languages

flutter_zxing's People

Contributors

axxel avatar bolisettysujith avatar bounty1342 avatar dependabot[bot] avatar giuliatesta avatar h1376h avatar hpoul avatar khoren93 avatar lucasnsa avatar phlip9 avatar softkot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flutter_zxing's Issues

CMake error when adding dependency to desktop

I wanted to test out the new desktop support (#36), but as soon as I added the dependency I ran into build errors on both Windows and Linux (I haven't tested on MacOS yet). All I did was add flutter_zxing: ^1.0.0 to pubspec.yaml, ran flutter pub get and then tried to build with flutter build linux (or windows). The error I'm getting is:

$ flutter build linux
💪 Building with sound null safety 💪

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
log-lib
    linked by target "flutter_zxing" in directory my-project/linux/flutter/ephemeral/.plugin_symlinks/flutter_zxing/src                                                             

CMake Generate step failed.  Build files cannot be regenerated correctly.
Building Linux application...
Unable to generate build files

The error on Windows is pretty much identical. Am I missing something obvious here?

Cmake

Hi
I am on the latest CMake version but I am getting an error
flutter_zxing-1.0.0/src/zxing/core/CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.14 or higher is required. You are running version 3.10.2

Front camera

Hi,
How do I activate the front camera to read the qrcode?

I am having issue with QR scanning in iOS

This library working fine in android but not working in iOS. And, there is no such issues encountered already and after cloning this library I have verified example app in same devices and got same issue.

Library Version -->> 1.1.2

Test performed in

  1. iPhone 7
  2. iPhone 13 Pro

My implementation

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("QR Code Scanner")),
      body: Stack(
        children: [
          ReaderWidget(
            isMultiScan: false,
            codeFormat: Format.qrCode,
            showFlashlight: false,
            showGallery: false,
            showToggleCamera: false,
            allowPinchZoom: false,
            onControllerCreated: (controller) async {
              if (controller != null) {
                cameraController = controller;
              }
            },
            scannerOverlay: DynamicScannerOverlay(
                borderColor: Theme.of(context).primaryColor),
            onScan: (result) async {
              await cameraController.pausePreview();
              _showAlertDialog("QR Code \n${result.text}");
            },
          ),
        ],
      ),
    );
  }

There is no such information in logcat regarding issue of not scanning the QR codes

`tryInverted` does not work with `readBarcodeImagePathString()`

Inverted QR codes that can be scanned with ReaderWidget cannot be scanned with readBarcodeImagePathString().

final code = await zx.readBarcodeImagePathString(
  'image path',
  params: Params(
    tryHarder: true,
    tryInverted: true,
  ),
);

Commenting out tryHarder: true did not affect the result.

get CameraException

I need to get CameraException when permission errors. can add some function to do this?

Camera preview is distorted on older Android devices

The red box in the screenshot below is a square, but it is shown as a rectangular on Android 5.1. It does not happen on my another phone with Android 10. I'm not really sure if it is related to Android versions though, because I have only those two real devices.

It didn't happen on the same device when I was using another QR scanner plugin.

Environment:

  • Android 5.1
  • flutter_zxing 0.9.1

Reproducible code:

import 'package:flutter/material.dart';
import 'package:flutter_zxing/flutter_zxing.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: ReaderWidget(
          onScan: (_) {},
        ),
      ),
    );
  }
}

Screenshot:

Feature request: Desktop support

Hello! Thanks for the work on this project!

I'd like to request desktop support (windows, MacOS and Linux) in this project. I'm not sure if it's in the scope of this project to capture from video streams or not on these platforms, but I think just being able to provide an image buffer and scan it for a QR code would be very useful. I can't help with development, but I can help with testing if needed!

updating with recent zxing cpp

hi @khoren93 thank you for your contribution for making flutter project with zxing cpp.
are you planning to update your recent source code with recent zxing cpp ? I try to copy the new source code from zxing-cpp\core to flutter_zxing\ios\Classes\src\zxing\src (and CMakeLists.txt and zxing.cmake) but got many error. For example like this :
C:/Users/home/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\locale:3689:17: note: candidate function not viable: requires 2 arguments, but 1 was provided byte_string to_bytes(const _Elem* __first, const _Elem* __last); ^ 1 warning and 1 error generated.

I'm still learning how to use cmake, and still trying to fix it.
Maybe if you have a time please help to write step by step about how to updating the source code from zxing-cpp to your flutter_zxing project. Thank you

scan image

How can I get the picture of the scan result?

Changing the ReaderWidget resolution from HIGH to MAX makes no difference

Hello,
Based on the requirements, I need to change the camera resolution from high to max. However, there is no noticeable difference in the preview image, and the scanning performance has not improved. Therefore, I assume that this could be a bug.

The third picture shows me using the default camera preview from the camera library. As you can see, the text is clearer and not blurred.

I am using version 1.1.2.
This is my code:

Widget build(BuildContext context) {
    return Scaffold(
      appBar: const OdetteAppBar(title: "Test DMC"),
      body: ReaderWidget(
        tryHarder: true,
        scanDelay: const Duration(milliseconds: 100),
        scanDelaySuccess: const Duration(milliseconds: 500),
        resolution: ResolutionPreset.max,
        isMultiScan: false,
        codeFormat: Format.dataMatrix,
        cropPercent: 0.6,
        showGallery: false,
        showToggleCamera: false,
        scannerOverlay: const FixedScannerOverlay(),
        onControllerCreated: (controller) async {
          if (controller != null) {
            _controller = controller;
          }
        },
        onScanFailure: _onScanFailure,
        onScan: (code) async {
          await _controller.pausePreview();
          _onScanSuccess(code);
        },
      ),
    );
  }

Screenshot_20230528-215012

Screenshot_20230528-215125

Screenshot_20230528-222014

onScan is not working on the Xiaomi Poco M3 device

onScan is not working on the Xiaomi Poco M3 device. I have provided camera permission, the camera image appears, but the code does not scan.

On the Samsung A30s device and emulator - it works.

Code sample

code from Example not work too

Logs
I/CameraManagerGlobal( 3943): Connecting to camera service
W/CameraManagerGlobal( 3943): [soar.cts] ignore the status update of camera: 2
W/CameraManagerGlobal( 3943): [soar.cts] ignore the status update of camera: 3
W/CameraManagerGlobal( 3943): [soar.cts] ignore the status update of camera: 4
W/CameraManagerGlobal( 3943): [soar.cts] ignore the status update of camera: 5
W/CameraManagerGlobal( 3943): [soar.cts] ignore the status update of camera: 6
W/CameraManagerGlobal( 3943): ignore the torch status update of camera: 3
W/CameraManagerGlobal( 3943): ignore the torch status update of camera: 4
W/CameraManagerGlobal( 3943): ignore the torch status update of camera: 5
E/libc    ( 3943): Access denied finding property "persist.vendor.camera.privapp.list"
W/ne.appany.reach( 3943): type=1400 audit(0.0:3041): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=16035 scontext=u:r:untrusted_app:s0:c48,c262,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
W/CameraManagerGlobal( 3943): ignore the torch status update of camera: 3
W/CameraManagerGlobal( 3943): ignore the torch status update of camera: 4
W/CameraManagerGlobal( 3943): ignore the torch status update of camera: 5
I/Camera  ( 3943): startPreview
W/libc    ( 3943): Unable to set property "persist.vendor.camera.mi.cameraid" to "false": connection failed; errno=13 (Permission denied)
W/ne.appany.reach( 3943): type=1400 audit(0.0:3044): avc: denied { write } for name="property_service" dev="tmpfs" ino=14666 scontext=u:r:untrusted_app:s0:c48,c262,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0
E/CameraManager( 3943): setprop error: java.lang.RuntimeException: failed to set system property
W/BpBinder( 3943): Slow Binder: BpBinder transact took 218ms, interface=android.hardware.camera2.ICameraDeviceUser, code=6 oneway=false
I/Camera  ( 3943): CameraCaptureSession onConfigured
I/Camera  ( 3943): Updating builder settings
D/Camera  ( 3943): Updating builder with feature: ExposureLockFeature
D/Camera  ( 3943): Updating builder with feature: ExposurePointFeature
D/Camera  ( 3943): Updating builder with feature: ZoomLevelFeature
D/Camera  ( 3943): Updating builder with feature: AutoFocusFeature
D/Camera  ( 3943): Updating builder with feature: NoiseReductionFeature
I/Camera  ( 3943): updateNoiseReduction | currentSetting: fast
D/Camera  ( 3943): Updating builder with feature: FocusPointFeature
D/Camera  ( 3943): Updating builder with feature: ResolutionFeature
D/Camera  ( 3943): Updating builder with feature: SensorOrientationFeature
D/Camera  ( 3943): Updating builder with feature: FlashFeature
D/Camera  ( 3943): Updating builder with feature: ExposureOffsetFeature
D/Camera  ( 3943): Updating builder with feature: FpsRangeFeature
I/Camera  ( 3943): refreshPreviewCaptureSession
W/pool-13-thread-( 3943): type=1400 audit(0.0:3045): avc: denied { read } for name="u:object_r:camx_hq_prop:s0" dev="tmpfs" ino=15920 scontext=u:r:untrusted_app:s0:c48,c262,c512,c768 tcontext=u:object_r:camx_hq_prop:s0 tclass=file permissive=0
E/libc    ( 3943): Access denied finding property "persist.vendor.camera.mi.cameraid"
W/BpBinder( 3943): Slow Binder: BpBinder transact took 215ms, interface=android.hardware.camera2.ICameraDeviceUser, code=14 oneway=false
W/BpBinder( 3943): Slow Binder: BpBinder transact took 293ms, interface=android.hardware.camera2.ICameraDeviceUser, code=6 oneway=false
I/Camera  ( 3943): startPreviewWithImageStream
I/Camera  ( 3943): CameraCaptureSession onConfigured
W/ne.appany.reac( 3943): Long monitor contention with owner main (3943) at boolean android.os.BinderProxy.transactNative(int, android.os.Parcel, android.os.Parcel, int)(BinderProxy.java:-2) waiters=0 in void android.hardware.camera2.impl.CameraDeviceImpl$4.run() for 512ms
I/Camera  ( 3943): Updating builder settings
D/Camera  ( 3943): Updating builder with feature: ExposureLockFeature
I/Camera  ( 3943): refreshPreviewCaptureSession
W/ne.appany.reach( 3943): type=1400 audit(0.0:3046): avc: denied { read } for name="u:object_r:camx_hq_prop:s0" dev="tmpfs" ino=15920 scontext=u:r:untrusted_app:s0:c48,c262,c512,c768 tcontext=u:object_r:camx_hq_prop:s0 tclass=file permissive=0
E/libc    ( 3943): Access denied finding property "persist.vendor.camera.mi.cameraid"
D/Camera  ( 3943): Updating builder with feature: ExposurePointFeature
I/Camera  ( 3943): CameraCaptureSession onClosed
D/Camera  ( 3943): Updating builder with feature: ZoomLevelFeature
D/Camera  ( 3943): Updating builder with feature: AutoFocusFeature
D/Camera  ( 3943): Updating builder with feature: NoiseReductionFeature
I/Camera  ( 3943): updateNoiseReduction | currentSetting: fast
D/Camera  ( 3943): Updating builder with feature: FocusPointFeature
D/Camera  ( 3943): Updating builder with feature: ResolutionFeature
D/Camera  ( 3943): Updating builder with feature: SensorOrientationFeature
D/Camera  ( 3943): Updating builder with feature: FlashFeature
D/Camera  ( 3943): Updating builder with feature: ExposureOffsetFeature
D/Camera  ( 3943): Updating builder with feature: FpsRangeFeature
I/Camera  ( 3943): refreshPreviewCaptureSession
E/libc    ( 3943): Access denied finding property "persist.vendor.camera.mi.cameraid"
W/System  ( 3943): A resource failed to call release.
Doctor output
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.19045.3570], locale en-US)
    • Flutter version 3.13.9 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (5 days ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2) 
    • Android SDK at G:\DB\soft_db\Android\Sdk\
    • Platform android-33-ext5, build-tools 33.0.2
    • ANDROID_HOME = G:\DB\soft_db\Android\Sdk\
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java       
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)       

[√] VS Code (version 1.83.1)
    • VS Code at C:\Users\ooovid\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0

[√] Connected device (3 available)
    • M2010J19CG (mobile) • 931c654c0920 • android-arm64  • Android 10 (API 29)
    • Chrome (web)        • chrome       • web-javascript • Google Chrome 118.0.5993.118
    • Edge (web)          • edge         • web-javascript • Microsoft Edge 118.0.2088.61

[√] Network resources
    • All expected network resources are available.

• No issues found!

Error: Type 'Uint8List' not found.

  • What went wrong:
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcode_reader.dart:76:3: Error: Type 'Uint8List' not found.
  Uint8List bytes, {
  ^^^^^^^^^
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcodes_reader.dart:76:3: Error: Type 'Uint8List' not found.
  Uint8List bytes, {

  ^^^^^^^^^
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcode_reader.dart:30:9: Error: 'Uint8List' isn't a type.
  final Uint8List imageBytes = await path.readAsBytes();
        ^^^^^^^^^
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcode_reader.dart:56:9: Error: 'Uint8List' isn't a type.
  final Uint8List imageBytes =

        ^^^^^^^^^
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcode_reader.dart:76:3: Error: 'Uint8List' isn't a type.

  Uint8List bytes, {
  ^^^^^^^^^
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcodes_reader.dart:30:9: Error: 'Uint8List' isn't a type.
  final Uint8List imageBytes = await path.readAsBytes();

        ^^^^^^^^^
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcodes_reader.dart:56:9: Error: 'Uint8List' isn't a type.

  final Uint8List imageBytes =
        ^^^^^^^^^
/C:/android/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.0/lib/src/logic/barcodes_reader.dart:76:3: Error: 'Uint8List' isn't a type.
  Uint8List bytes, {
  ^^^^^^^^^

  • flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.856], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (not installed)
[√] VS Code (version 1.71.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

Switch Camera

Hi,
would it be possible to switch the camera from code?
If yes, could you show me an example?
Thank you.

stop reason = EXC_BAD_ACCESS (code=1, address=0x1062d8000)

i want to print a qrcode.

insert the code outside of class
final result = zx.encodeBarcode( 'Text to encode', format: Format.qrCode, width: 300, height: 300, margin: 10, eccLevel: 0, );

put this code in the _MyHomePageState build function
final imglib.Image img;
Uint8List encodedBytes = Uint8List.fromList([0]);
if (result.isValid && result.data != null) {
img = imglib.Image.fromBytes(300, 100, result.data!.toList());
encodedBytes = Uint8List.fromList(imglib.encodeJpg(img));
// use encodedBytes as you wish
}

console:

  • thread #9, name = 'io.flutter.1.ui', stop reason = EXC_BAD_ACCESS (code=1, address=0x1062d8000)
    frame #0: 0x00000001043110f4 Flutterdart::BootstrapNatives::DN_TypedData_GetInt8(dart::Thread*, dart::Zone*, dart::NativeArguments*) + 300 Flutterdart::BootstrapNatives::DN_TypedData_GetInt8:
    -> 0x1043110f4 <+300>: ldrsb x8, [x0, x21]
    0x1043110f8 <+304>: lsl x0, x8, #1
    0x1043110fc <+308>: ldp x29, x30, [sp, #0x20]
    0x104311100 <+312>: ldp x20, x19, [sp, #0x10]
    Target 0: (Runner) stopped.

flutter version:3.3.10
library version:^0.9.0
ios:15.1

Cannot compile for web

Hello I'm having this issue where ffi isn't found when compiling for web. It works fine for mobile. Our app has a dependency override ffi: ^2.0.1

 Launching lib/main.dart on Chrome in debug mode...
: Error: Not found: 'dart:ffi'
import 'dart:ffi' as ffi;
       ^

: Error: Not found: 'dart:ffi'
import 'dart:ffi';
       ^
: Error: Not found: 'dart:ffi'
import 'dart:ffi';
       ^

: Error: Not found: 'dart:ffi'
import 'dart:ffi';
       ^

: Error: Not found: 'dart:ffi'
import 'dart:ffi';
       ^

: Error: Not found: 'dart:ffi'
import 'dart:ffi';
       ^

: Error: Not found: 'dart:ffi'
import 'dart:ffi';
       ^

: Error: Type 'ffi.NativeType' not found.
  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
                                          ^^^^^^^^^^^^^^
: Error: Type 'ffi.Pointer' not found.
  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
        ^^^^^^^^^^^

: Error: Type 'ffi.DynamicLibrary' not found.
  GeneratedBindings(ffi.DynamicLibrary dynamicLibrary)
                    ^^^^^^^^^^^^^^^^^^

: Error: Type 'ffi.NativeType' not found.
      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)

                                        ^^^^^^^^^^^^^^
: Error: Type 'ffi.Pointer' not found.
      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
      ^^^^^^^^^^^

: Error: Type 'ffi.Char' not found.
  ffi.Pointer<ffi.Char> version() {

              ^^^^^^^^
: Error: Type 'ffi.Pointer' not found.

  ffi.Pointer<ffi.Char> version() {
  ^^^^^^^^^^^
: Error: Type 'ffi.Char' not found.
    ffi.Pointer<ffi.Char> bytes,

                ^^^^^^^^
: Error: Type 'ffi.Pointer' not found.

    ffi.Pointer<ffi.Char> bytes,
    ^^^^^^^^^^^
: Error: Type 'ffi.Char' not found.
    ffi.Pointer<ffi.Char> bytes,

                ^^^^^^^^
: Error: Type 'ffi.Pointer' not found.
    ffi.Pointer<ffi.Char> bytes,

    ^^^^^^^^^^^
: Error: Type 'ffi.Char' not found.
    ffi.Pointer<ffi.Char> contents,
                ^^^^^^^^

: Error: Type 'ffi.Pointer' not found.
    ffi.Pointer<ffi.Char> contents,
    ^^^^^^^^^^^
: Error: Type 'ffi.Struct' not found.
class Pos extends ffi.Struct {
                  ^^^^^^^^^^

: Error: Type 'ffi.Struct' not found.
class CodeResult extends ffi.Struct {
                         ^^^^^^^^^^
: Error: Type 'ffi.Char' not found.
  external ffi.Pointer<ffi.Char> text;
                       ^^^^^^^^

: Error: Type 'ffi.Pointer' not found.
  external ffi.Pointer<ffi.Char> text;
           ^^^^^^^^^^^
: Error: Type 'ffi.UnsignedChar' not found.
  external ffi.Pointer<ffi.UnsignedChar> bytes;

                       ^^^^^^^^^^^^^^^^
: Error: Type 'ffi.Pointer' not found.

  external ffi.Pointer<ffi.UnsignedChar> bytes;
           ^^^^^^^^^^^
: Error: Type 'ffi.Pointer' not found.
  external ffi.Pointer<Pos> pos;

           ^^^^^^^^^^^
: Error: Type 'ffi.Struct' not found.
class CodeResults extends ffi.Struct {
                          ^^^^^^^^^^

: Error: Type 'ffi.Pointer' not found.
  external ffi.Pointer<CodeResult> results;
           ^^^^^^^^^^^
: Error: Type 'ffi.Struct' not found.
class EncodeResult extends ffi.Struct {

                           ^^^^^^^^^^
: Error: Type 'ffi.Char' not found.
  external ffi.Pointer<ffi.Char> text;
                       ^^^^^^^^

: Error: Type 'ffi.Pointer' not found.
  external ffi.Pointer<ffi.Char> text;
           ^^^^^^^^^^^
: Error: Type 'ffi.SignedChar' not found.

  external ffi.Pointer<ffi.SignedChar> data;
                       ^^^^^^^^^^^^^^
: Error: Type 'ffi.Pointer' not found.
  external ffi.Pointer<ffi.SignedChar> data;
           ^^^^^^^^^^^
: Error: Type 'ffi.Char' not found.
  external ffi.Pointer<ffi.Char> error;
                       ^^^^^^^^
: Error: Type 'ffi.Pointer' not found.
  external ffi.Pointer<ffi.Char> error;
           ^^^^^^^^^^^
: Error: Type 'DynamicLibrary' not found.
DynamicLibrary _openDynamicLibrary() {
^^^^^^^^^^^^^^

: Error: Type 'DynamicLibrary' not found.
DynamicLibrary dylib = _openDynamicLibrary();

^^^^^^^^^^^^^^
: Error: Type 'Char' not found.
  Pointer<Char> allocatePointer() {
          ^^^^
: Error: Type 'Pointer' not found.
  Pointer<Char> allocatePointer() {
  ^^^^^^^
: Error: Type 'DynamicLibrary' not found.
final DynamicLibrary stdlib = Platform.isWindows
      ^^^^^^^^^^^^^^
: Error: Type 'Pointer' not found.
typedef PosixMallocNative = Pointer Function(IntPtr);
                            ^^^^^^^
: Error: Type 'IntPtr' not found.
typedef PosixMallocNative = Pointer Function(IntPtr);
                                             ^^^^^^
: Error: Type 'Pointer' not found.
typedef PosixMalloc = Pointer Function(int);
                      ^^^^^^^
: Error: Type 'Pointer' not found.
typedef PosixCallocNative = Pointer Function(IntPtr num, IntPtr size);
                            ^^^^^^^
: Error: Type 'IntPtr' not found.
typedef PosixCallocNative = Pointer Function(IntPtr num, IntPtr size);
                                             ^^^^^^
: Error: Type 'IntPtr' not found.
typedef PosixCallocNative = Pointer Function(IntPtr num, IntPtr size);
                                                         ^^^^^^
: Error: Type 'Pointer' not found.
typedef PosixCalloc = Pointer Function(int num, int size);
                      ^^^^^^^
: Error: Type 'Void' not found.
typedef PosixFreeNative = Void Function(Pointer);
                          ^^^^
: Error: Type 'Pointer' not found.

typedef PosixFreeNative = Void Function(Pointer);
                                        ^^^^^^^
: Error: Type 'Pointer' not found.
typedef PosixFree = void Function(Pointer);
                                  ^^^^^^^
: Error: Type 'Pointer' not found.
typedef WinCoTaskMemAllocNative = Pointer Function(Size cb);
                                  ^^^^^^^
: Error: Type 'Size' not found.
typedef WinCoTaskMemAllocNative = Pointer Function(Size cb);
                                                   ^^^^
: Error: Type 'Pointer' not found.
typedef WinCoTaskMemAlloc = Pointer Function(int cb);
                            ^^^^^^^
: Error: Type 'Void' not found.
typedef WinCoTaskMemFreeNative = Void Function(Pointer pv);
                                 ^^^^
: Error: Type 'Pointer' not found.
typedef WinCoTaskMemFreeNative = Void Function(Pointer pv);
                                               ^^^^^^^
: Error: Type 'Pointer' not found.
typedef WinCoTaskMemFree = void Function(Pointer pv);
                                         ^^^^^^^
: Error: Type 'Allocator' not found.
class _MallocAllocator implements Allocator {
                                  ^^^^^^^^^
: Error: Type 'Pointer' not found.
  Pointer<T> allocate<T extends NativeType>(int byteCount, {int? alignment}) {
  ^^^^^^^
: Error: Type 'NativeType' not found.
  Pointer<T> allocate<T extends NativeType>(int byteCount, {int? alignment}) {
                                ^^^^^^^^^^
: Error: Type 'Pointer' not found.
  void free(Pointer pointer) {
            ^^^^^^^
: Error: Type 'Allocator' not found.
const Allocator malloc = _MallocAllocator();
      ^^^^^^^^^
: Error: Type 'Allocator' not found.
class _CallocAllocator implements Allocator {
                                  ^^^^^^^^^
: Error: Type 'Pointer' not found.
  void _fillMemory(Pointer destination, int length, int fill) {
                   ^^^^^^^
: Error: Type 'Pointer' not found.
  void _zeroMemory(Pointer destination, int length) =>
                   ^^^^^^^
: Error: Type 'Pointer' not found.
  Pointer<T> allocate<T extends NativeType>(int byteCount, {int? alignment}) {
  ^^^^^^^
: Error: Type 'NativeType' not found.
  Pointer<T> allocate<T extends NativeType>(int byteCount, {int? alignment}) {
                                ^^^^^^^^^^
: Error: Type 'Pointer' not found.
  void free(Pointer pointer) {
            ^^^^^^^
: Error: Type 'Allocator' not found.
const Allocator calloc = _CallocAllocator();
      ^^^^^^^^^
: Error: Type 'Allocator' not found.
class Arena implements Allocator {
                       ^^^^^^^^^
: Error: Type 'Allocator' not found.
  final Allocator _wrappedAllocator;
        ^^^^^^^^^
: Error: Type 'NativeType' not found.
  final List<Pointer<NativeType>> _managedMemoryPointers = [];
                     ^^^^^^^^^^
: Error: Type 'Pointer' not found.
  final List<Pointer<NativeType>> _managedMemoryPointers = [];
             ^^^^^^^
: Error: Type 'Allocator' not found.
  Arena([Allocator allocator = calloc]) : _wrappedAllocator = allocator;
         ^^^^^^^^^
: Error: Type 'Pointer' not found.
  Pointer<T> allocate<T extends NativeType>(int byteCount, {int? alignment}) {
  ^^^^^^^
: Error: Type 'NativeType' not found.
  Pointer<T> allocate<T extends NativeType>(int byteCount, {int? alignment}) {
                                ^^^^^^^^^^
: Error: Type 'NativeType' not found.
  void free(Pointer<NativeType> pointer) {}
                    ^^^^^^^^^^
: Error: Type 'Pointer' not found.
  void free(Pointer<NativeType> pointer) {}
            ^^^^^^^
: Error: Type 'Allocator' not found.
    [Allocator wrappedAllocator = calloc]) {
     ^^^^^^^^^
: Error: Type 'Allocator' not found.
    [Allocator wrappedAllocator = calloc]) {
     ^^^^^^^^^
: Error: Type 'Opaque' not found.
class Utf8 extends Opaque {}
                   ^^^^^^
: Error: Type 'Pointer' not found.
extension Utf8Pointer on Pointer<Utf8> {
                         ^^^^^^^
: Error: Type 'Uint8' not found.
  static int _length(Pointer<Uint8> codeUnits) {
                             ^^^^^
: Error: Type 'Pointer' not found.
  static int _length(Pointer<Uint8> codeUnits) {
                     ^^^^^^^
: Error: Type 'Pointer' not found.
  Pointer<Utf8> toNativeUtf8({Allocator allocator = malloc}) {
  ^^^^^^^
: Error: Type 'Allocator' not found.
  Pointer<Utf8> toNativeUtf8({Allocator allocator = malloc}) {
                              ^^^^^^^^^
: Error: Type 'Opaque' not found.
class Utf16 extends Opaque {}
                    ^^^^^^
: Error: Type 'Pointer' not found.
extension Utf16Pointer on Pointer<Utf16> {
                          ^^^^^^^
: Error: Type 'Uint16' not found.
  static String _toKnownLengthString(Pointer<Uint16> codeUnits, int length) =>

                                             ^^^^^^
: Error: Type 'Pointer' not found.

  static String _toKnownLengthString(Pointer<Uint16> codeUnits, int length) =>
                                     ^^^^^^^
: Error: Type 'Uint16' not found.
  static String _toUnknownLengthString(Pointer<Uint16> codeUnits) {
                                               ^^^^^^
: Error: Type 'Pointer' not found.
  static String _toUnknownLengthString(Pointer<Uint16> codeUnits) {
                                       ^^^^^^^
: Error: Type 'Uint16' not found.
  static int _length(Pointer<Uint16> codeUnits) {
                             ^^^^^^
: Error: Type 'Pointer' not found.
  static int _length(Pointer<Uint16> codeUnits) {
                     ^^^^^^^
: Error: Type 'Pointer' not found.
  Pointer<Utf16> toNativeUtf16({Allocator allocator = malloc}) {

  ^^^^^^^
: Error: Type 'Allocator' not found.
  Pointer<Utf16> toNativeUtf16({Allocator allocator = malloc}) {
                                ^^^^^^^^^

: Error: 'Void' isn't a type.
      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int)>>('setLogEnabled');
                                     ^^^^
: Error: 'Int' isn't a type.
      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int)>>('setLogEnabled');
                                                       ^^^
: Error: 'NativeFunction' isn't a type.
      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int)>>('setLogEnabled');
                  ^^^^^^^^^^^^^^
: Error: 'Char' isn't a type.
      _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>('version');
                                                 ^^^^
: Error: 'Pointer' isn't a type.
      _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>('version');
                                     ^^^^^^^
: Error: 'NativeFunction' isn't a type.

      _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>('version');
                  ^^^^^^^^^^^^^^
: Error: 'Char' isn't a type.
      _versionPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();

                                             ^^^^
: Error: 'Pointer' isn't a type.

      _versionPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
                                 ^^^^^^^
: Error: 'Char' isn't a type.
          CodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
                                              ^^^^
: Error: 'Pointer' isn't a type.
          CodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,

                                  ^^^^^^^
: Error: 'Int' isn't a type.
          CodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,

                                                         ^^^
: Error: 'Int' isn't a type.

          CodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
                                                                  ^^^
: Error: 'Int' isn't a type.
          CodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
                                                                           ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcode');
                  ^^^
: Error: 'Int' isn't a type.

              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcode');
                           ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcode');
                                    ^^^
: Error: 'Int' isn't a type.

              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcode');
                                             ^^^
: Error: 'NativeFunction' isn't a type.
      ffi.NativeFunction<

          ^^^^^^^^^^^^^^
: Error: 'Char' isn't a type.
          ffi.Pointer<ffi.Char>, int, int, int, int, int, int, int)>();

                          ^^^^
: Error: 'Pointer' isn't a type.

          ffi.Pointer<ffi.Char>, int, int, int, int, int, int, int)>();
              ^^^^^^^
: Error: 'Char' isn't a type.
          CodeResults Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
                                               ^^^^
: Error: 'Pointer' isn't a type.
          CodeResults Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,

                                   ^^^^^^^
: Error: 'Int' isn't a type.
          CodeResults Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,

                                                          ^^^
: Error: 'Int' isn't a type.

          CodeResults Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
                                                                   ^^^
: Error: 'Int' isn't a type.
          CodeResults Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
                                                                            ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcodes');
                  ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcodes');
                           ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcodes');
                                    ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcodes');
                                             ^^^
: Error: 'NativeFunction' isn't a type.
      ffi.NativeFunction<
          ^^^^^^^^^^^^^^
: Error: 'Char' isn't a type.
          ffi.Pointer<ffi.Char>, int, int, int, int, int, int, int)>();
                          ^^^^
: Error: 'Pointer' isn't a type.
          ffi.Pointer<ffi.Char>, int, int, int, int, int, int, int)>();
              ^^^^^^^
: Error: 'Char' isn't a type.
          EncodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int,
                                                ^^^^
: Error: 'Pointer' isn't a type.
          EncodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int,
                                    ^^^^^^^
: Error: 'Int' isn't a type.
          EncodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int,
                                                           ^^^
: Error: 'Int' isn't a type.
          EncodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int,
                                                                    ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int)>>('encodeBarcode');
                  ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int)>>('encodeBarcode');
                           ^^^
: Error: 'Int' isn't a type.
              ffi.Int, ffi.Int, ffi.Int)>>('encodeBarcode');
                                    ^^^
: Error: 'NativeFunction' isn't a type.
      ffi.NativeFunction<
          ^^^^^^^^^^^^^^
: Error: 'Char' isn't a type.
      EncodeResult Function(ffi.Pointer<ffi.Char>, int, int, int, int, int)>();
                                            ^^^^
: Error: 'Pointer' isn't a type.
      EncodeResult Function(ffi.Pointer<ffi.Char>, int, int, int, int, int)>();
                                ^^^^^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.

  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int32'.
  @ffi.Int32()
       ^^^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: Couldn't find constructor 'Int32'.
  @ffi.Int32()
       ^^^^^
: Error: Couldn't find constructor 'Int'.
  @ffi.Int()
       ^^^
: Error: 'NativeType' isn't a type.
  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
                                              ^^^^^^^^^^
: Error: 'Pointer' isn't a type.

  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
            ^^^^^^^
: Error: 'DynamicLibrary' isn't a type.
  GeneratedBindings(ffi.DynamicLibrary dynamicLibrary)
                        ^^^^^^^^^^^^^^
: Error: 'NativeType' isn't a type.
      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
                                            ^^^^^^^^^^
: Error: 'Pointer' isn't a type.
      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
          ^^^^^^^
: Error: 'Char' isn't a type.
    ffi.Pointer<ffi.Char> bytes,
                    ^^^^
: Error: 'Pointer' isn't a type.
    ffi.Pointer<ffi.Char> bytes,
        ^^^^^^^
: Error: 'Char' isn't a type.
    ffi.Pointer<ffi.Char> bytes,
                    ^^^^
: Error: 'Pointer' isn't a type.
    ffi.Pointer<ffi.Char> bytes,

        ^^^^^^^
: Error: 'Char' isn't a type.
    ffi.Pointer<ffi.Char> contents,
                    ^^^^

: Error: 'Pointer' isn't a type.
    ffi.Pointer<ffi.Char> contents,
        ^^^^^^^

: Error: 'Char' isn't a type.
  external ffi.Pointer<ffi.Char> text;
                           ^^^^
: Error: 'Pointer' isn't a type.
  external ffi.Pointer<ffi.Char> text;
               ^^^^^^^
: Error: 'UnsignedChar' isn't a type.
  external ffi.Pointer<ffi.UnsignedChar> bytes;

                           ^^^^^^^^^^^^
: Error: 'Pointer' isn't a type.

  external ffi.Pointer<ffi.UnsignedChar> bytes;
               ^^^^^^^
: Error: 'Pointer' isn't a type.
  external ffi.Pointer<Pos> pos;
               ^^^^^^^
: Error: 'Pointer' isn't a type.
  external ffi.Pointer<CodeResult> results;
               ^^^^^^^
: Error: 'Char' isn't a type.
  external ffi.Pointer<ffi.Char> text;
                           ^^^^
: Error: 'Pointer' isn't a type.
  external ffi.Pointer<ffi.Char> text;
               ^^^^^^^
: Error: 'SignedChar' isn't a type.
  external ffi.Pointer<ffi.SignedChar> data;
                           ^^^^^^^^^^
: Error: 'Pointer' isn't a type.

  external ffi.Pointer<ffi.SignedChar> data;
               ^^^^^^^
: Error: 'Char' isn't a type.
  external ffi.Pointer<ffi.Char> error;
                           ^^^^
: Error: 'Pointer' isn't a type.
  external ffi.Pointer<ffi.Char> error;

               ^^^^^^^
: Error: 'Char' isn't a type.
    contents.toNativeUtf8().cast<Char>(),
                                 ^^^^
: Error: Undefined name 'DynamicLibrary'.
    return DynamicLibrary.open('libflutter_zxing.so');
           ^^^^^^^^^^^^^^
: Error: Undefined name 'DynamicLibrary'.
    return DynamicLibrary.open('flutter_zxing_windows_plugin.dll');
           ^^^^^^^^^^^^^^
: Error: Undefined name 'DynamicLibrary'.
  return DynamicLibrary.process();
         ^^^^^^^^^^^^^^

: Error: 'DynamicLibrary' isn't a type.
DynamicLibrary dylib = _openDynamicLibrary();
^^^^^^^^^^^^^^

: Error: 'Int8' isn't a type.
    final Pointer<Int8> blob = calloc<Int8>(length);
                  ^^^^
: Error: 'Pointer' isn't a type.
    final Pointer<Int8> blob = calloc<Int8>(length);
          ^^^^^^^
: Error: 'Int8' isn't a type.
    final Pointer<Int8> blob = calloc<Int8>(length);
                                      ^^^^
: Error: 'Char' isn't a type.
    return blob.cast<Char>();
                     ^^^^
: Error: The getter 'nullptr' isn't defined for the class 'CodeResult'.
- 'CodeResult' is from 'package:flutter_zxing/generated_bindings.dart' ('../../../Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.5/lib/generated_bindings.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'nullptr'.

      text == nullptr ? null : text.cast<Utf8>().toDartString();
              ^^^^^^^
: Error: 'Int8' isn't a type.
      Uint8List.fromList(bytes.cast<Int8>().asTypedList(length));
                                    ^^^^

: Error: The getter 'nullptr' isn't defined for the class 'EncodeResult'.
- 'EncodeResult' is from 'package:flutter_zxing/generated_bindings.dart' ('../../../Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.8.5/lib/generated_bindings.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'nullptr'.

      text == nullptr ? null : text.cast<Utf8>().toDartString();
              ^^^^^^^
: Error: 'Int8' isn't a type.

      Uint32List.fromList(data.cast<Int8>().asTypedList(length));
                                    ^^^^
: Error: 'DynamicLibrary' isn't a type.
final DynamicLibrary stdlib = Platform.isWindows
      ^^^^^^^^^^^^^^
: Error: Undefined name 'DynamicLibrary'.
    ? DynamicLibrary.open('ole32.dll')
      ^^^^^^^^^^^^^^
: Error: Undefined name 'DynamicLibrary'.
    : DynamicLibrary.process();

      ^^^^^^^^^^^^^^
: Error: 'Pointer' isn't a type.
    Pointer<T> result;

    ^^^^^^^
: Error: 'Pointer' isn't a type.
  void free(Pointer pointer) {
            ^^^^^^^
: Error: 'Allocator' isn't a type.
const Allocator malloc = _MallocAllocator();
      ^^^^^^^^^
: Error: 'Pointer' isn't a type.
  void _fillMemory(Pointer destination, int length, int fill) {
                   ^^^^^^^
: Error: 'Uint8' isn't a type.
    final ptr = destination.cast<Uint8>();
                                 ^^^^^
: Error: 'Pointer' isn't a type.
  void _zeroMemory(Pointer destination, int length) =>
                   ^^^^^^^
: Error: 'Pointer' isn't a type.
    Pointer<T> result;
    ^^^^^^^
: Error: 'Pointer' isn't a type.
  void free(Pointer pointer) {
            ^^^^^^^
: Error: 'Allocator' isn't a type.
const Allocator calloc = _CallocAllocator();
      ^^^^^^^^^
: Error: 'Allocator' isn't a type.
  final Allocator _wrappedAllocator;
        ^^^^^^^^^
: Error: 'NativeType' isn't a type.
  final List<Pointer<NativeType>> _managedMemoryPointers = [];
                     ^^^^^^^^^^
: Error: 'Pointer' isn't a type.
  final List<Pointer<NativeType>> _managedMemoryPointers = [];
             ^^^^^^^

: Error: 'Allocator' isn't a type.
  Arena([Allocator allocator = calloc]) : _wrappedAllocator = allocator;
         ^^^^^^^^^
: Error: 'NativeType' isn't a type.
  void free(Pointer<NativeType> pointer) {}
                    ^^^^^^^^^^
: Error: 'Pointer' isn't a type.
  void free(Pointer<NativeType> pointer) {}
            ^^^^^^^
: Error: 'Allocator' isn't a type.
    [Allocator wrappedAllocator = calloc]) {
     ^^^^^^^^^
: Error: 'Allocator' isn't a type.
    [Allocator wrappedAllocator = calloc]) {
     ^^^^^^^^^
: Error: 'Uint8' isn't a type.
    final codeUnits = cast<Uint8>();
                           ^^^^^
: Error: 'Uint8' isn't a type.
    final codeUnits = cast<Uint8>();
                           ^^^^^

: Error: 'Uint8' isn't a type.
  static int _length(Pointer<Uint8> codeUnits) {
                             ^^^^^
: Error: 'Pointer' isn't a type.
  static int _length(Pointer<Uint8> codeUnits) {
                     ^^^^^^^
: Error: 'Allocator' isn't a type.
  Pointer<Utf8> toNativeUtf8({Allocator allocator = malloc}) {
                              ^^^^^^^^^
: Error: 'Uint8' isn't a type.
    final Pointer<Uint8> result = allocator<Uint8>(units.length + 1);
                  ^^^^^
: Error: 'Pointer' isn't a type.
    final Pointer<Uint8> result = allocator<Uint8>(units.length + 1);
          ^^^^^^^
: Error: 'Uint8' isn't a type.
    final Pointer<Uint8> result = allocator<Uint8>(units.length + 1);
                                            ^^^^^
: Error: 'Uint16' isn't a type.
    final codeUnits = cast<Uint16>();
                           ^^^^^^
: Error: 'Uint16' isn't a type.
    final codeUnits = cast<Uint16>();
                           ^^^^^^
: Error: 'Uint16' isn't a type.
  static String _toKnownLengthString(Pointer<Uint16> codeUnits, int length) =>
                                             ^^^^^^
: Error: 'Pointer' isn't a type.
  static String _toKnownLengthString(Pointer<Uint16> codeUnits, int length) =>

                                     ^^^^^^^
: Error: 'Uint16' isn't a type.

  static String _toUnknownLengthString(Pointer<Uint16> codeUnits) {
                                               ^^^^^^
: Error: 'Pointer' isn't a type.
  static String _toUnknownLengthString(Pointer<Uint16> codeUnits) {
                                       ^^^^^^^

: Error: 'Uint16' isn't a type.
  static int _length(Pointer<Uint16> codeUnits) {

                             ^^^^^^
: Error: 'Pointer' isn't a type.
  static int _length(Pointer<Uint16> codeUnits) {
                     ^^^^^^^
: Error: 'Allocator' isn't a type.
  Pointer<Utf16> toNativeUtf16({Allocator allocator = malloc}) {
                                ^^^^^^^^^
: Error: 'Uint16' isn't a type.
    final Pointer<Uint16> result = allocator<Uint16>(units.length + 1);
                  ^^^^^^
: Error: 'Pointer' isn't a type.
    final Pointer<Uint16> result = allocator<Uint16>(units.length + 1);
          ^^^^^^^
: Error: 'Uint16' isn't a type.
    final Pointer<Uint16> result = allocator<Uint16>(units.length + 1);
                                             ^^^^^^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int topLeftX;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int topLeftY;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int topRightX;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int topRightY;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int bottomLeftX;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int bottomLeftY;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int bottomRightX;

               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int bottomRightY;
               ^

: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int isValid;
               ^

: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external ffi.Pointer<ffi.Char> text;

                                 ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external ffi.Pointer<ffi.UnsignedChar> bytes;
                                         ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int length;
               ^
: Error: Only JS interop members may be 'external'.

Try removing the 'external' keyword or adding a JS interop annotation.
  external int format;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.

  external ffi.Pointer<Pos> pos;
                            ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int count;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external ffi.Pointer<CodeResult> results;
                                   ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int isValid;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external ffi.Pointer<ffi.Char> text;
                                 ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int format;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external ffi.Pointer<ffi.SignedChar> data;
                                       ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external int length;
               ^
: Error: Only JS interop members may be 'external'.
Try removing the 'external' keyword or adding a JS interop annotation.
  external ffi.Pointer<ffi.Char> error;

                                 ^
Failed to compile application.
Exited

Unable to recognize the QR code from the image, the Codes are empty strings on Android and iOS

Please fix this issue as soon as possible, otherwise I'll have to add another image QR code recognition library for this.
Device:Xiaomi 13、iPhone 14 Pro

`I/flutter (30296): [E] zx.readBarcodeImagePathString : code==null --> false

I/flutter (30296): [E] zx.readBarcodeImagePathString : code.text -->

I/flutter (30296): [E] zx.readBarcodeImagePathString : code.text.length --> 0`

Removing ReaderWidget before it becomes ready causes error

import 'package:flutter/material.dart';
import 'package:flutter_zxing/flutter_zxing.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(
        builder: (context) => Scaffold(
          body: Center(
            child: ElevatedButton(
              onPressed: () => showDialog(
                context: context,
                builder: (_) => const _Dialog(),
              ),
              child: const Text('Open scan dialog'),
            ),
          ),
        ),
      ),
    );
  }
}

class _Dialog extends StatelessWidget {
  const _Dialog();

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      content: AspectRatio(
        aspectRatio: 3 / 4,
        child: ReaderWidget(onScan: (_) {}),
      ),
      actions: [
        ElevatedButton(
          onPressed: () => Navigator.of(context).pop(),
          child: const Text('Close'),
        ),
      ],
    );
  }
}

Steps to reproduce:

  1. Tap on the "Open scan dialog" button.
  2. It opens a dialog with ReaderWidget.
  3. Close the dialog before the camera preview appears.
  4. See the output in the console.

It gives different errors depending on how quickly the dialog is closed.

a) If it is very quick:

I/flutter (16061): Error: A CameraController was used after being disposed.
I/flutter (16061): Once you have called dispose() on a CameraController, it can no longer be used.
E/flutter (16061): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: A CameraController was used after being disposed.
E/flutter (16061): Once you have called dispose() on a CameraController, it can no longer be used.
E/flutter (16061): #0      ChangeNotifier.debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:147:9)
E/flutter (16061): #1      ChangeNotifier.debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:154:6)
E/flutter (16061): #2      ChangeNotifier.addListener (package:flutter/src/foundation/change_notifier.dart:207:27)
E/flutter (16061): #3      _ReaderWidgetState.onNewCameraSelected (package:flutter_zxing/src/ui/reader_widget.dart:158:17)

b) If it is a little later:

======== Exception caught by services library ======================================================
The following PlatformException was thrown while activating platform stream on channel plugins.flutter.io/camera_android/imageStream:
PlatformException(error, Attempt to invoke virtual method 'void android.media.ImageReader.setOnImageAvailableListener(android.media.ImageReader$OnImageAvailableListener, android.os.Handler)' on a null object reference, null, null)

When the exception was thrown, this was the stack: 
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
<asynchronous suspension>
#2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:637:9)
<asynchronous suspension>
====================================================================================================

onControllerCreated callback is sometimes not called in v1.1.1

The example app below shows a MaterialBanner when the callback of onControllerCreated is called. As you can see, it is not shown once in several times. I didn't see this issue when I was using 1.0.0.

Code
import 'package:flutter/material.dart';
import 'package:flutter_zxing/flutter_zxing.dart';

void main() => runApp(const App());

class App extends StatefulWidget {
  const App({super.key});

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  final _pageController = PageController();
  int _page = 0;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      scaffoldMessengerKey: scaffoldMessengerKey,
      home: Scaffold(
        body: PageView(
          controller: _pageController,
          onPageChanged: _switchPage,
          children: const [
            _ScanView(),
            _SecondView(),
          ],
        ),
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: _page,
          onTap: _switchPage,
          items: const [
            BottomNavigationBarItem(
              icon: Icon(Icons.photo_camera),
              label: 'Page 1',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.star),
              label: 'Page 2',
            ),
          ],
        ),
      ),
    );
  }

  void _switchPage(int page) {
    setState(() => _page = page);
    _pageController.jumpToPage(page);
    if (page == 1) {
      _hideMaterialBanner();
    }
  }
}

class _ScanView extends StatelessWidget {
  const _ScanView();

  @override
  Widget build(BuildContext context) {
    return ReaderWidget(
      onControllerCreated: (_) => _showMaterialBanner(),
      onScan: (code) => print(code.text),
    );
  }
}

class _SecondView extends StatelessWidget {
  const _SecondView();

  @override
  Widget build(BuildContext context) {
    return const Center(
      child: Text('Page 2'),
    );
  }
}

//===================================================================

final scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>();

void _showMaterialBanner() {
  scaffoldMessengerKey.currentState!.showMaterialBanner(
    MaterialBanner(
      content: const Text('Controller was created.'),
      actions: [
        IconButton(
          icon: const Icon(Icons.close),
          onPressed: () => _hideMaterialBanner(),
        ),
      ],
      contentTextStyle: const TextStyle(color: Colors.white),
      backgroundColor: Colors.green,
    ),
  );
}

void _hideMaterialBanner() {
  scaffoldMessengerKey.currentState!.hideCurrentMaterialBanner();
}

Logs

When the callback was called
I/Camera  (26384): close
E/libc    (26384): Access denied finding property "persist.vendor.camera.privapp.list"
I/Camera  (26384): startPreview
I/Camera  (26384): CameraCaptureSession onConfigured
I/Camera  (26384): Updating builder settings
D/Camera  (26384): Updating builder with feature: ExposureLockFeature
D/Camera  (26384): Updating builder with feature: ExposurePointFeature
D/Camera  (26384): Updating builder with feature: ZoomLevelFeature
D/Camera  (26384): Updating builder with feature: AutoFocusFeature
D/Camera  (26384): Updating builder with feature: NoiseReductionFeature
I/Camera  (26384): updateNoiseReduction | currentSetting: fast
D/Camera  (26384): Updating builder with feature: FocusPointFeature
D/Camera  (26384): Updating builder with feature: ResolutionFeature
D/Camera  (26384): Updating builder with feature: SensorOrientationFeature
D/Camera  (26384): Updating builder with feature: FlashFeature
D/Camera  (26384): Updating builder with feature: ExposureOffsetFeature
D/Camera  (26384): Updating builder with feature: FpsRangeFeature
I/Camera  (26384): refreshPreviewCaptureSession
I/Camera  (26384): startPreviewWithImageStream
I/Camera  (26384): CameraCaptureSession onConfigured
I/Camera  (26384): Updating builder settings
D/Camera  (26384): Updating builder with feature: ExposureLockFeature
D/Camera  (26384): Updating builder with feature: ExposurePointFeature
D/Camera  (26384): Updating builder with feature: ZoomLevelFeature
D/Camera  (26384): Updating builder with feature: AutoFocusFeature
D/Camera  (26384): Updating builder with feature: NoiseReductionFeature
I/Camera  (26384): updateNoiseReduction | currentSetting: fast
D/Camera  (26384): Updating builder with feature: FocusPointFeature
D/Camera  (26384): Updating builder with feature: ResolutionFeature
D/Camera  (26384): Updating builder with feature: SensorOrientationFeature
D/Camera  (26384): Updating builder with feature: FlashFeature
D/Camera  (26384): Updating builder with feature: ExposureOffsetFeature
D/Camera  (26384): Updating builder with feature: FpsRangeFeature
I/Camera  (26384): refreshPreviewCaptureSession
I/Camera  (26384): refreshPreviewCaptureSession
I/Camera  (26384): CameraCaptureSession onClosed
W/System  (26384): A resource failed to call release. 
W/System  (26384): A resource failed to call release. 
E/System  (26384): Uncaught exception thrown by finalizer
E/System  (26384): java.util.concurrent.RejectedExecutionException: Task android.hardware.camera2.impl.-$$Lambda$CallbackProxies$SessionStateCallbackProxy$9H0ZdANdMrdpoq2bfIL2l3DVsKk@423824c rejected from java.util.concurrent.ThreadPoolExecutor@799d295[Shutting down, pool size = 1, active threads = 0, queued tasks = 0, completed tasks = 4]
E/System  (26384): 	at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2086)
E/System  (26384): 	at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:848)
E/System  (26384): 	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1394)
E/System  (26384): 	at java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:630)
E/System  (26384): 	at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.onClosed(CallbackProxies.java:104)
E/System  (26384): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:536)
E/System  (26384): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl.finalize(CameraCaptureSessionImpl.java:827)
E/System  (26384): 	at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:289)
E/System  (26384): 	at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:276)
E/System  (26384): 	at java.lang.Daemons$Daemon.run(Daemons.java:137)
E/System  (26384): 	at java.lang.Thread.run(Thread.java:919)
When the callback was not called
I/Camera  (26384): close
E/libc    (26384): Access denied finding property "persist.vendor.camera.privapp.list"
I/Camera  (26384): startPreview
I/Camera  (26384): CameraCaptureSession onConfigured
I/Camera  (26384): Updating builder settings
D/Camera  (26384): Updating builder with feature: ExposureLockFeature
D/Camera  (26384): Updating builder with feature: ExposurePointFeature
D/Camera  (26384): Updating builder with feature: ZoomLevelFeature
D/Camera  (26384): Updating builder with feature: AutoFocusFeature
D/Camera  (26384): Updating builder with feature: NoiseReductionFeature
I/Camera  (26384): updateNoiseReduction | currentSetting: fast
D/Camera  (26384): Updating builder with feature: FocusPointFeature
D/Camera  (26384): Updating builder with feature: ResolutionFeature
D/Camera  (26384): Updating builder with feature: SensorOrientationFeature
D/Camera  (26384): Updating builder with feature: FlashFeature
D/Camera  (26384): Updating builder with feature: ExposureOffsetFeature
D/Camera  (26384): Updating builder with feature: FpsRangeFeature
I/Camera  (26384): refreshPreviewCaptureSession
I/Camera  (26384): startPreviewWithImageStream
I/Camera  (26384): refreshPreviewCaptureSession
I/Camera  (26384): refreshPreviewCaptureSession: captureSession not yet initialized, skipping preview capture session refresh.
I/Camera  (26384): CameraCaptureSession onConfigured
I/Camera  (26384): Updating builder settings
D/Camera  (26384): Updating builder with feature: ExposureLockFeature
D/Camera  (26384): Updating builder with feature: ExposurePointFeature
D/Camera  (26384): Updating builder with feature: ZoomLevelFeature
D/Camera  (26384): Updating builder with feature: AutoFocusFeature
D/Camera  (26384): Updating builder with feature: NoiseReductionFeature
I/Camera  (26384): updateNoiseReduction | currentSetting: fast
D/Camera  (26384): Updating builder with feature: FocusPointFeature
D/Camera  (26384): Updating builder with feature: ResolutionFeature
D/Camera  (26384): Updating builder with feature: SensorOrientationFeature
D/Camera  (26384): Updating builder with feature: FlashFeature
D/Camera  (26384): Updating builder with feature: ExposureOffsetFeature
D/Camera  (26384): Updating builder with feature: FpsRangeFeature
I/Camera  (26384): refreshPreviewCaptureSession
I/Camera  (26384): CameraCaptureSession onClosed
W/System  (26384): A resource failed to call release. 
W/System  (26384): A resource failed to call release. 
E/System  (26384): Uncaught exception thrown by finalizer
E/System  (26384): java.util.concurrent.RejectedExecutionException: Task android.hardware.camera2.impl.-$$Lambda$CallbackProxies$SessionStateCallbackProxy$9H0ZdANdMrdpoq2bfIL2l3DVsKk@5fa07b2 rejected from java.util.concurrent.ThreadPoolExecutor@f79b303[Shutting down, pool size = 1, active threads = 0, queued tasks = 0, completed tasks = 3]
E/System  (26384): 	at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2086)
E/System  (26384): 	at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:848)
E/System  (26384): 	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1394)
E/System  (26384): 	at java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:630)
E/System  (26384): 	at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.onClosed(CallbackProxies.java:104)
E/System  (26384): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:536)
E/System  (26384): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl.finalize(CameraCaptureSessionImpl.java:827)
E/System  (26384): 	at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:289)
E/System  (26384): 	at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:276)
E/System  (26384): 	at java.lang.Daemons$Daemon.run(Daemons.java:137)
E/System  (26384): 	at java.lang.Thread.run(Thread.java:919)

Environment

  • Android 10 (real device), 13 (emulator)
  • Flutter 3.7.3

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  flutter_zxing: ^1.1.1

I haven't checked 1.0.1 - 1.1.0, and I don't know either if it happens on iOS too.

IOS Scan barcode dont work

I try to read a barcode on Iphone but when the camera is scanning an error ocurred "flutter: type 'ArgumentError' is not a subtype of type 'Code' in type cast"
I try to debug the erro but i dont see where happend and on Android all works very fine.

Can you help me with this?

Thanks

Issue with Android 13 (SDK 33)

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.EncoderProfiles$VideoProfile.getWidth()' on a null object reference
E/AndroidRuntime(26879): at android.app.ActivityThread.deliverResults(ActivityThread.java:5347)
E/AndroidRuntime(26879): at android.app.ActivityThread.handleSendResult(ActivityThread.java:5386)
E/AndroidRuntime(26879): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
E/AndroidRuntime(26879): at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
E/AndroidRuntime(26879): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(26879): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(26879): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2308)
E/AndroidRuntime(26879): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(26879): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(26879): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(26879): at android.app.ActivityThread.main(ActivityThread.java:7898)
E/AndroidRuntime(26879): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(26879): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(26879): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/AndroidRuntime(26879): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.EncoderProfiles$VideoProfile.getWidth()' on a null object reference

Failed to lookup symbol 'readBarcode'

This issue exists in latest commit (4ebc637) and not version 0.10.0

1. Underlying Exception

Path

/Users/user/.pub-cache/git/flutter_zxing-4ebc637dfb3208f72c9c8adda813e1f58d3ed99a/lib/generated_bindings.dart

Exception

Exception has occurred.
ArgumentError (Invalid argument(s): Failed to lookup symbol 'readBarcode': dlsym(RTLD_DEFAULT, readBarcode): symbol not found)

Offending code

late final _readBarcodePtr = _lookup<
      ffi.NativeFunction<
          CodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
              ffi.Int, ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcode');
// ---------------------------------------------------------^

2. User-Facing Exception

Path

/Users/user/.pub-cache/git/flutter_zxing-4ebc637dfb3208f72c9c8adda813e1f58d3ed99a/lib/zxing_mobile.dart

Exception

Exception has occurred.
_CastError (type 'ArgumentError' is not a subtype of type 'Code' in type cast)

Offending code

await zxingProcessCameraImage(image, params: params) as Code;
// --------------------------------------------------^

3. Usage

Init / Dispose

// StatefulWidget state property
final Zxing zxMobile = ZxingMobile();

// called from initState
await zxMobile.startCameraProcessing();

// called inside dispose
zxMobile.stopCameraProcessing();

processCameraImage

// `CameraImage` object comes from `startImageStream` from `camera` package
// https://github.com/flutter/plugins/blob/729c14a9243ebd2b16d7ec2a63b4e54661b00641/packages/camera/camera/lib/src/camera_controller.dart#L415
Code zxBarcode = await zxMobile.processCameraImage(
    cameraImage,
    params: DecodeParams(
        tryHarder: false,
        tryRotate: true,
        tryInverted: false,
    ),
);

4. pubspec.yaml

offending versions

flutter_zxing:
  git:
    url: https://github.com/khoren93/flutter_zxing.git
    ref: 4ebc637dfb3208f72c9c8adda813e1f58d3ed99a

working pubspec.yaml

flutter_zxing: 0.10.0

Platform Information

  • iOS
Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b8f7f1f986 (9 weeks ago) • 2022-11-23 06:43:51 +0900
Engine • revision 8f2221fbef
Tools • Dart 2.18.5 • DevTools 2.15.0

ReaderWidget onScan never called on iOS

Hi, I can't scan QRCode on iOS. ReaderWidget onScan is never called, it is always scanning.

flutter_zxing: ^1.1.2

Tested on iPhone XR (iOS 16.1.2)

Works fine on my Android phone.

Error while building example

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':flutter_zxing:buildCMakeDebug[arm64-v8a]'.

Build command failed.
Error while executing process /home/user/Android/Sdk/cmake/3.18.1/bin/ninja with arguments {-C /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/android/.cxx/Debug/6m632u53/arm64-v8a flutter_zxing}
ninja: Entering directory `/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/android/.cxx/Debug/6m632u53/arm64-v8a'
[1/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/TextEncoder.cpp.o
[2/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZToken.cpp.o
[3/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZReader.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZReader.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZReader.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZReader.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZReader.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/aztec/AZReader.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/aztec/AZReader.cpp:13:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/BinaryBitmap.h:13:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[4/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/MultiFormatReader.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/MultiFormatReader.cpp:7:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/MultiFormatReader.h:12:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[5/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/GlobalHistogramBinarizer.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/GlobalHistogramBinarizer.cpp:7:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/GlobalHistogramBinarizer.h:9:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/BinaryBitmap.h:13:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[6/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZEncoder.cpp.o
[7/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/ReedSolomonEncoder.cpp.o
[8/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatWriter.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatWriter.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatWriter.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatWriter.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatWriter.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/MultiFormatWriter.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/MultiFormatWriter.cpp:20:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/pdf417/PDFWriter.h:12:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[9/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/HybridBinarizer.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/HybridBinarizer.cpp:7:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/HybridBinarizer.h:9:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/GlobalHistogramBinarizer.h:9:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/BinaryBitmap.h:13:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[10/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/Result.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/Result.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/Result.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/Result.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/Result.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/Result.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/Result.cpp:9:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/DecoderResult.h:13:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[11/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/ReadBarcode.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/ReadBarcode.cpp:9:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/GlobalHistogramBinarizer.h:9:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/BinaryBitmap.h:13:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[12/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/BinaryBitmap.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/BinaryBitmap.cpp:6:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/BinaryBitmap.h:13:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[13/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZDecoder.cpp.o
FAILED: zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZDecoder.cpp.o
/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I"/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src" -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZDecoder.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZDecoder.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZDecoder.cpp.o -c '/home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/aztec/AZDecoder.cpp'
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/aztec/AZDecoder.cpp:14:
In file included from /home/user/Desktop/My World/XMPP gsoc/flutter_zxing/src/zxing/core/src/DecoderResult.h:13:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[14/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZDetector.cpp.o
[15/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZHighLevelEncoder.cpp.o
[16/83] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/aztec/AZWriter.cpp.o
ninja: build stopped: subcommand failed.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 8s
Running Gradle task 'assembleDebug'... 9.5s
Exception: Gradle task assembleDebug failed with exit code 1

Get raw bytes when reading DataMatrix format

I am reading a DataMatrix file and I need the exact raw bytes because the data stored in the DataMatrix is data compressed with zip and any sort of encoding messes up some of the bytes and the data cannot be read. I would need a Uint8List with the raw bytes.

Can you help?

onScan callback of ReaderWidget is not called on older Android devices

I've experienced the issue on Android 5.1, but not on Android 10. I haven't tried on other Android versions.

Environment:

  • Android 5.1
  • flutter_zxing 0.9.1

Reproducible code:

android/app/src/main/AndroidManifest.xml

<!-- Add AdMob app ID -->
<!-- e.g. ca-app-pub-3940256099942544~3347511713 -->
<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>

lib/main.dart

import 'package:flutter/material.dart';

import 'package:flutter_zxing/flutter_zxing.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  MobileAds.instance.initialize();

  runApp(const App());
}

class App extends StatefulWidget {
  const App({super.key});

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  late final _ad = BannerAd(
    adUnitId: 'ca-app-pub-3940256099942544/6300978111', // Demo banner ad unit ID
    size: AdSize.banner,
    request: const AdRequest(),
    listener: const BannerAdListener(),
  )..load();

  @override
  void dispose() {
    _ad.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.black,
        body: Column(
          children: [
            Expanded(
              child: ReaderWidget(
                onScan: (code) {
                  print('text: ${code.text}'); // This is never called.
                },
              ),
            ),
            SizedBox(
              height: 50.0,
              child: AdWidget(ad: _ad),
            ),
          ],
        ),
      ),
    );
  }
}

ReaderWidget/processCameraImage not working on some android devices

Lib Version: 1.2.1

Tested devices:

  1. Motorola G32 (not ok)
  2. Samsung A23 (not ok)
  3. Samsung S10 (ok)

Hello, I have tested on some devices, and neither of them can read any barcode. I have tested using the example code, the zx.processCameraImage, and I have also downloaded the ZXScanner. Unfortunately, none of them seem to be able to scan any QR code on those devices. It doesn't not return any error, it just doesn't read anything.

I have tested on a Samsung S10, and it worked fine, though.

The implementation that i did is on the doc examples without any change.

Thanks in advance!

Cannot scan barcode in image

Scanning a barcode in an image returns Code with empty text and error at 1.4.0 and 1.4.1. There was no issue at the point of v1.3.2.

Code sample

  1. Create a new Flutter project.
  2. Create an "assets" folder and place an image in there.
  3. Run the code below.
  4. Press the button and see the text shown in the screen.

pubspec.yaml

...


dependencies:
  ...
  flutter_zxing: 1.4.1
  path_provider: ^2.1.1

...

flutter:
  assets:
    - assets/

main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:flutter_zxing/flutter_zxing.dart';
import 'package:path_provider/path_provider.dart';

void main() => runApp(const App());

class App extends StatefulWidget {
  const App();

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  Code? _code;

  Future<void> _read() async {
    final image = await rootBundle.load('assets/image.jpg'); // Put the actual file name

    final dir = await getTemporaryDirectory();
    final file = File('${dir.path}/${DateTime.now().microsecondsSinceEpoch}');
    file.writeAsBytesSync(image.buffer.asUint8List());

    final code = await zx.readBarcodeImagePathString(file.path);
    setState(() => _code = code);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                ElevatedButton(
                  onPressed: _read,
                  child: const Text('Scan'),
                ),
                const SizedBox(height: 24.0),
                Text('Text: ${_code?.text}'),
                Text('Error: ${_code?.error}'),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

I have a problem with reading a barcode on iOS

the camera tries to scan the barcode, but it fails to scan it and this error appears flutter: type 'ArgumentError' is not a subtype of type 'Code' in type cast.

updated library to version 1.2.0, but it still doesn't scan the barcode

the implementation that was made is this

qr

Image v4

In 949dc88 the image dependency was downgraded to v3 again. Can we get v4 again? I'm trying to use this libary together with other libraries that depend on image v4.

readBarcode does not work

Hi. I need to read about 40 barcodes from a single image at once. I have attempted to split the image into 30 smaller and equal parts and read the barcodes from each part individually. But when I use 'readBarcode', It doesn't work and I'm getting nothing. This is my code:

List splitImageParts = [];
@OverRide
void initState() {
// TODO: implement initState
WidgetsBinding.instance.addPostFrameCallback((_) async {
List imageBytes = await getImageBytes('assets/images/bs_image2.png');
imglib.Image? inputImage = imglib.decodeImage(Uint8List.fromList(imageBytes));
splitImageParts = await splitImage(inputImage: inputImage!, horizontalPieceCount: 4, verticalPieceCount: 10);
});
super.initState();
}

Future<List> getImageBytes(String imagePath) async {
ByteData imageData = await rootBundle.load(imagePath);
Uint8List bytes = imageData.buffer.asUint8List();
return bytes.toList();
}

Future<List> splitImage({required imglib.Image inputImage, required int horizontalPieceCount, required int verticalPieceCount}) async {

imglib.Image image = inputImage;
int x = 0, y = 0;
int width = (image.width / horizontalPieceCount).round();
int height = (image.height / verticalPieceCount).round();

// split image to parts
List<imglib.Image> parts = <imglib.Image>[];
for (int i = 0; i < verticalPieceCount; i++) {
  for (int j = 0; j < horizontalPieceCount; j++) {
    parts.add(imglib.copyCrop(image, x: x, y: y, width: width, height: height));
    x += width;
  }
  x = 0;
  y += height;
}

// convert image from image package to Image Widget to display
List<Image> outputImageList = <Image>[];
for (var img in parts) {
  // ByteData imageData = await rootBundle.load(image);
  Uint8List bytes = img.buffer.asUint8List();
  Code? barcode = zx.readBarcode(bytes, width: width, height: height);
  if (barcode != null) {
    if (barcode.text != null) {
      print(barcode.text);
    }
  }
  outputImageList.add(Image.memory(imglib.encodeJpg(img)));
}
return outputImageList;

}

ReaderWidget does not scan anything on iPad

I'm really impressed that it works really stable on Android. I don't have any issues that I had with other similar packages. It's great.

However, I tried it next on my iPad and found that the same code wouldn't work. Are you aware of the issue that onScan is never called on iPadOS? I have no idea if the same thing also happens on iOS because I don't have an iPhone.

It appears that it's only an issue of scanning.

  • Camera preview is working.
  • The onControllerCreated callback is called.
  • scannerOverlay has no issue either.

Just FYI, a message "setFlashModeFailed: Devide does not have flash capabilities" is printed in the console when the camera is ready, although I don't think this has anything to do with the issue.

Cmake error while building for Android

Hello,
I'm getting this error while trying to build for Android.
It used to work, but I cannot pinpoint easily which dependency or Flutter version triggered the issue, but I've recently switched to Flutter 3.8.0-10.1.pre on the beta channel.

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_zxing:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/android/.cxx/Debug/1l4a6h4w/arm64-v8a'
  [1/87] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o
  FAILED: zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o 
  /home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -I/home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/BinaryBitmap.cpp.o -c /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/BinaryBitmap.cpp
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/BinaryBitmap.cpp:6:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/BinaryBitmap.h:13:
  /snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
    const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  [2/87] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o
  FAILED: zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o 
  /home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -I/home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/GlobalHistogramBinarizer.cpp.o -c /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/GlobalHistogramBinarizer.cpp
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/GlobalHistogramBinarizer.cpp:7:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/GlobalHistogramBinarizer.h:9:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/BinaryBitmap.h:13:
  /snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
    const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  [3/87] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o
  FAILED: zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o 
  /home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -I/home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/HybridBinarizer.cpp.o -c /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/HybridBinarizer.cpp
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/HybridBinarizer.cpp:7:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/HybridBinarizer.h:9:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/GlobalHistogramBinarizer.h:9:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/BinaryBitmap.h:13:
  /snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
    const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  [4/87] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/ReedSolomonDecoder.cpp.o
  [5/87] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o
  FAILED: zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o 
  /home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -I/home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/MultiFormatReader.cpp.o -c /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/MultiFormatReader.cpp
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/MultiFormatReader.cpp:7:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/MultiFormatReader.h:12:
  /snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
    const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  [6/87] Building CXX object zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o
  FAILED: zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o 
  /home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/mauro/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -I/home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src -Izxing/core -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type -pthread -std=gnu++17 -MD -MT zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o -MF zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o.d -o zxing/core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o -c /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/ReadBarcode.cpp
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/ReadBarcode.cpp:9:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/GlobalHistogramBinarizer.h:9:
  In file included from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/src/zxing/core/src/BinaryBitmap.h:13:
  /snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
    const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /home/mauro/Android/Sdk/cmake/3.18.1/bin/ninja \
        -C \
        /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/android/.cxx/Debug/1l4a6h4w/arm64-v8a \
        flutter_zxing
    from /home/mauro/.pub-cache/hosted/pub.dev/flutter_zxing-1.1.1/android

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 13s
Exception: Gradle task assembleDebug failed with exit code 1

Windows Compilation Failing

Hey there, thank you for creating this zxing binding for flutter. I tried to include this with my app on Windows but the compilation fails, I have tried everything to debug this including cloning this repo recursively and seeing if windows would compile the example app, but unfortunately it doesn't. In the documentation it says Windows is not supported yet, but in pub.dev and in this repos issues, there are mentions of desktop now working for this project, so I don't know if it is supposed to work or not.

Here are the logs left from the attempted compilation of this project's example app:

D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(78,17): error C2589: '(': illegal token on right side of '::' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(78,1): error C2062: type 'unknown-type' unexpected [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(78,1): error C2059: syntax error: ')' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(79,17): error C2589: '(': illegal token on right side of '::' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(79,1): error C2062: type 'unknown-type' unexpected [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(79,1): error C2059: syntax error: ')' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(80,48): error C2589: '(': illegal token on right side of '::' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(80,1): error C2062: type 'unknown-type' unexpected [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(80,1): error C2059: syntax error: ')' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(81,49): error C2589: '(': illegal token on right side of '::' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(81,1): error C2062: type 'unknown-type' unexpected [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\zxing\core\src\ImageView.h(81,1): error C2059: syntax error: ')' [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(33,45): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(21,9): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(27,9): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(47,10): error C2375: 'setLogEnabled': redefinition; different linkage [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(53,17): error C2375: 'version': redefinition; different linkage [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(60,23): error C2375: 'readBarcode': redefinition; different linkage [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(86,24): error C2375: 'readBarcodes': redefinition; different linkage [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(119,25): error C2375: 'encodeBarcode': redefinition; different linkage [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
D:\StudioProjects\flutter_zxing\example\windows\flutter\ephemeral\.plugin_symlinks\flutter_zxing\src\native_zxing.cpp(136,13): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [D:\StudioProjects\flutter_zxing\example\build\windows\plugins\flutter_zxing\shared\flutter_zxing.vcxproj]
Exception: Build process failed.

Please let me know if the project is supposed to work on desktop and more specifically windows, if so if there are any other limitations like versioning. If it is not supposed to work, I would still like to be able to compile the app and just leave some UnsupportedPlatform widgets whenever a Windows user tries to use the scanner.

Kind Regards,
SimpleTheory

App crash when width/height are too bigger in encodeBarcode()

Hello :)

I want to generate a barcode in aztec format.
So I use the encodeBarcode() method, to which I send the data and set the parameters.
The default width/height (120px) doesn't work for me, so I increase it.

class BarcodeGeneratorService implements BarcodeGeneratorInterface {
  final Zxing _barcodeGenerator;

  BarcodeGeneratorService({Zxing? flutterZxing}) : _barcodeGenerator = flutterZxing ?? Zxing();
  @override
  Uint8List? encode({
    required String textToEncode,
    required int format,
    required int width,
    required int height,
    required int margin,
  }) {
    final encoded = _barcodeGenerator.encodeBarcode(
        contents: textToEncode,
        params: EncodeParams(format: Format.aztec,  width: 150, height: 150 , eccLevel: EccLevel.high));

    if (!encoded.isValid || encoded.data == null) {
      return null;
    }
    final imglib.Image img = imglib.Image.fromBytes(
      150,
      150,
      encoded.data!,
    );
    return Uint8List.fromList(
      imglib.encodeJpg(img),
    );
  }
}

When I want to display my barcode, when the encodeBarcode() method is triggered, my application crashes at this point.

The crash occurs on several physical iOS devices, in 16 and 16.5.
On the other hand, everything works fine on simulator.

The error is not very clear:

image

Do you have any idea what it could be?

Thanks :)

A CameraController was used after being disposed

hi,sir,
On iOS,
Only after the first installation and permission, the following error will appear. When I try to use the cameracontroller to avoid this problem, I cannot refer to it.
However, this error did not affect the normal operation of the program , But the picture in the camera is shaking badly. It didn't happen yesterday, it often happens today

flutter: AppLifecycleState.resumed
[VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: A CameraController was used after being disposed.
Once you have called dispose() on a CameraController, it can no longer be used.
#0 ChangeNotifier._debugAssertNotDisposed. (package:flutter/src/foundation/change_notifier.dart:125:9)
#1 ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:131:6)
#2 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:304:12)
#3 ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:428:5)
#4 CameraController.setFlashMode (package:camera/src/camera_controller.dart:624:7)

#5 _ReaderWidgetState.onNewCameraSelected (package:flutter_zxing/src/ui/reader_widget.dart:132:7)

On Android,
I got seven warnings, I'm not sure if it's the reference of this plug-in. But I don't use the camera anywhere else.
After sudo rm -rf .pub-cache,it is ok.

like this
my_flutter_stable_sdk/flutter/.pub-cache/hosted/pub.flutter-io.cn/camera_android-0.10.0+1/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java:154: 警告: [deprecation] CamcorderProfile中的get(int,int)已过时
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH);

CamcorderProfile.QUALITY_2160P,
CamcorderProfile.QUALITY_1080P,
CamcorderProfile.QUALITY_720P,
CamcorderProfile.QUALITY_480P,
CamcorderProfile.QUALITY_QVGA
CamcorderProfile.QUALITY_LOW

Barcode scan with black background issue

I have an issue scanning barcode which has a black background.

The scanner don’t scan the barcode only works if background is white.

Example of black background barcode which not able to scan.
barcode_example

Questions about the package

Hi,

Thanks you for the package, really like it.

I do have some questions and remarks.

1 - I wonder if the await is necessary there, at least it should be after the availableCameras().

  Future<void> initStateAsync() async {
    // Spawn a new isolate
    await startCameraProcessing();

    availableCameras().then((List<CameraDescription> cameras) {
      setState(() {
        this.cameras = cameras;
        if (cameras.isNotEmpty) {
          onNewCameraSelected(cameras.first);
        }
      });
    });
  }

2 - rebuildOnMount, probably clean to go with a widgetsbinding.instance.addpostframecallback
3 - Maybe on evolution could be to screenShoot the QRCode and display it. It should be doable with the takePicture method.
4 - Would you like me to add a scanning animation to the ReaderWidget, activated by a boolean, or better as an optional overlay so people could implement their own if they prefer ?

Regards

onScan is called again when ReaderWidget is shown after stopImageStream() is used

Below is an example app to demonstrate the issue.

  1. The camera preview is shown.
  2. If a barcode / QR code is scanned, the onScan callback is called. In the callback:
    • stopImageStream() is called.
    • The scanned text is assigned to _text.
  3. The camera preview is removed and the result view is shown.
  4. If the "Back to camera" button is pressed, the camera preview is shown.
  5. onScan is called immediately and the result view is shown. (This is wrong!)
  6. If the "Back to camera" button is pressed, the camera preview is shown.
  7. onScan is not called this time.
import 'package:flutter/material.dart';

import 'package:camera/camera.dart';
import 'package:flutter_zxing/flutter_zxing.dart';

void main() {
  runApp(const App());
}

class App extends StatefulWidget {
  const App({super.key});

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  String? _text;
  CameraController? _controller;

  @override
  Widget build(BuildContext context) {
    final text = _text;
    final scanned = text != null && text.isNotEmpty;

    return MaterialApp(
      home: Scaffold(
        body: scanned
            ? Center(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(text),
                    ElevatedButton(
                      onPressed: () => setState(() => _text = null),
                      child: const Text('Back to camera'),
                    ),
                  ],
                ),
              )
            : ReaderWidget(
                onControllerCreated: (controller) {
                  _controller = controller;
                },
                onScan: (code) async {
                  await _controller?.stopImageStream(); // This causes the issue.
                  setState(() => _text = code.text);
                },
              ),
      ),
    );
  }
}

I used stopImageStream() because I had experienced duplicate calls to the scan callback in another plugin. I'm not sure if it can happen with flutter_zxing too, but I wanted to make sure onScan() was called only once.

I don't think it is a critical issue, but it took me hours to figure out that stopImageStream() was causing it, and I still have no idea why it is wrong to use it there. I feel that something is wrong in the package and it is better that the issue is fixed so that other developers won't experience it.

QR code in large image is not scanned

readBarcodeImagePathString() fails to scan a QR code in an image taken from slightly off to the side, while ReaderWidget can successfully scan the same QR from the same position. Do you have any idea why there is such a difference?

To reproduce it, please try scanning the QR code below with ReaderWidget and readBarcodeImagePathString() (or it may be reproduced with other similar methods like readBarcodeImagePath(). I'm not sure about it as I haven't used them.)

Image in memory, points QRCODE

Good afternoon, how are you? can the package take the image that was used and save it locally, or in memory so it can send it to an API? Does the location of the QRCODE points also identify?

0.7.1 does not build on android

* What went wrong:
Execution failed for task ':flutter_zxing:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using /home/kot/bin/flutter2/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.7.1/ios/Classes/src/CMakeLists.txt: Build command failed.
  Error while executing process /home/kot/Android/Sdk/cmake/3.18.1/bin/cmake with arguments {-H/home/kot/bin/flutter2/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.7.1/ios/Classes/src -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_PLATFORM=android-21 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=/home/kot/Android/Sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/home/kot/Android/Sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/home/kot/Android/Sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/home/kot/Android/Sdk/cmake/3.18.1/bin/ninja -DCMAKE_CXX_FLAGS=-frtti -fexceptions -std=c++2a -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/kot/Projects/SKLLZZ/hrp-flutter/build/flutter_zxing/intermediates/cxx/Debug/1k1385k1/obj/arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/home/kot/Projects/SKLLZZ/hrp-flutter/build/flutter_zxing/intermediates/cxx/Debug/1k1385k1/obj/arm64-v8a -DCMAKE_BUILD_TYPE=Debug -B/home/kot/bin/flutter2/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.7.1/android/.cxx/Debug/1k1385k1/arm64-v8a -GNinja -DANDROID_STL=c++_shared}
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /home/kot/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /home/kot/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring incomplete, errors occurred!
  See also "/home/kot/bin/flutter2/.pub-cache/hosted/pub.dartlang.org/flutter_zxing-0.7.1/android/.cxx/Debug/1k1385k1/arm64-v8a/CMakeFiles/CMakeOutput.log".

  CMake Error at CMakeLists.txt:14 (add_subdirectory):
    add_subdirectory given source "ZXing" which is not an existing directory.
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.4 LTS 5.15.0-41-generic, locale ru_RU.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

Mistakes in README.md

import 'package:flutter_zxing/flutter_zxing.dart';

...

CodeResult? resultFromXFile = await FlutterZxing.readImagePath(xFile);

FlutterZxing looks like a class name, but it does not exist. If you mean a prefix for the library, the as keyword should be used.

But as FlutterZxing violates the library_prefixes rule:

DO use lowercase_with_underscores when specifying a library prefix".

Just zxing might be better.

import 'package:flutter_zxing/flutter_zxing.dart' as zxing;

Method names are also wrong. readImagePath, readImagePathString and readImageUrl are actually readBarcodeImagePath, readBarcodeImagePathString and readBarcodeImageUrl. There may be more mistakes.

Crash Release Android x86

This bug is reproducible when you generate the app using in release mode and you open it in an x86 or arm32 emulator

If you are having issues opening an app on your x86 or arm32 emulator, you may be seeing the following error message: "{AppName} consistently crashes". This may be caused by the fact that Flutter does not support x86 files, as mentioned in this link: https://docs.flutter.dev/deployment/android#what-are-the-supported-target-architectures. According to the documentation, Flutter currently does not offer support for generating x86 files for Android (see Issue 9253).

This can be a particularly problematic when you are trying to use packages that depend on resources such as the camera or MLKit. To resolve this issue, you can edit the 'build.grandle' file in the 'app' folder and add the following lines to prevent the generation of x86 files:

   defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
        }
    }

This should help resolve the issue and allow you to open the app on the emulator without errors. It is important to remember that Flutter currently only supports the armeabi-v7a (ARM 32-bit), arm64-v8a (ARM 64-bit), and x86-64 (x86 64-bit) target architectures. Therefore, when editing the 'build.grandle' file, it is important to ensure that you are only including these architectures.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.