native_qr 0.0.2
native_qr: ^0.0.2 copied to clipboard
The simplest QR code scanner for Flutter ever.
native_qr #
The simplest QR code scanner for Flutter ever.
This is the thin wrapper for the native IOS and Android OS provided QR code scanners. If you need just scan one QR code and proceed with the result, this plugin is all you need.
Getting Started #
- Install the plugin.
$ flutter pub add native_qr
- Import it.
import 'package:native_qr/native_qr.dart';
- Call the get() method.
try {
NativeQr nativeQr = NativeQr();
String? result = await nativeQr.get();
} catch(err) {
print(err);
}
Platform notes #
IOS #
Camera permission is required, so Privacy - Camera Usage Description
aka NSCameraUsageDescription
has to be set in your Info.plist
IOS implementation uses DataScannerViewController, which is available since version 16.0, so you have to set project deployment target to 16.0 to use this plugin.
The running device must have the A12 Bionic chip or later.
If your app requires Live Text for its core functionality, you can make your app available only on devices that support Live Text. Add the UIRequiredDeviceCapabilities
key to your app’s information property list and include the iphone-ipad-minimum-performance-a12
subkey in the array of device capabilities.
Android #
Minimum project requirements are:
minSdkVersion 21
targetSdkVersion 33
Android implementation uses GmsBarcodeScanner which is based on Google play services. To load it automatically you have to add the following to your application AndroidManifest.xml, otherwise the very first scan attempts will fail while Android is downloading the scanner.
<application ...>
...
<meta-data
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="barcode_ui"/>
...
</application>
Limitations and known issues #
- Only QR codes supported (can be changed in case it is needed, open a feature request on Github)
- IOS implementation since 16.0 (which is 81% of the market share as for March, 2023)
- Only string representation of QR encoded data is provided
- The result will be only one QR in the camera's field of view, which one is unpredictable
- IOS multiscene apps unsupported, the plugin uses the first scene to present the camera view