Closed om-ha closed 10 months ago
Another question if you may, which one is more recommended when using flutter_zxing with camera package?
processCameraImage
(parameter is CameraImage
)readBarcode
(parameter is image bytes InputImage
-> byte list property Uint8List?
)Thanks for reaching out.
Since version 1.0.0, the flutter_zxing package uses submodules, so specifying a specific version in the pubspec file is not possible. To use the main branch, you will need to manually clone it locally using the command "git clone --recursive https://github.com/khoren93/flutter_zxing.git". Once the package is cloned, navigate to the "scripts" directory using "cd scripts" and run the script "sh update_ios_macos_src.sh". After this, you can add the flutter_zxing package as a local dependency in the pubspec file by specifying the path of the cloned local repository. For example, if you cloned the package in your home directory, the path would be
flutter_zxing:
path: ~/flutter_zxing
For the second question, it is highly recommended to use the processCameraImage method, rather than the readBarcode method. The reason for this is that processCameraImage is specifically designed to work with the camera stream, and it processes the stream in a separate isolate. This allows for more efficient and reliable barcode scanning, as well as improved performance and reduced memory usage. However, the readBarcode method can still be used to read barcodes from local image files, such as those from the gallery or from a URL. It takes as parameter bytes (Uint8List) and it's more appropriate for use with static images rather than a camera stream.
Closing for now as this is already fixed.
This issue exists in latest commit (4ebc637dfb3208f72c9c8adda813e1f58d3ed99a) 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
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
3. Usage
Init / Dispose
processCameraImage
4. pubspec.yaml
offending versions
working pubspec.yaml
Platform Information