English Document | 中文文档 |
---|
ai_barcode: Support Android and IOS recognition of 'one-dimensional barcode' and 'two-dimensional barcode'
Highlights: `` ai_barcode: Support Scanner embedded in flutter pages to meet changing business needs ''
iOS-Scanner | Android-Scanner |
---|---|
:- | :- |
iOS-Creator | Android-Creator |
---|---|
:- | :- |
Web-Creator |
---|
:- |
ai_barcode inproject practical application flutter sample
Download Android apk | ios ipa obtained by running the project | Blog web site |
---|
Use this package as a library
Add this to your package's pubspec.yaml file:
dependencies:
ai_barcode: ^version
Or depending on
dependencies:
# barcode plugin.
ai_barcode:
git:
url: https://github.com/pdliuw/ai_barcode.git
You can install packages from the command line:
with Flutter:
$ flutter pub get
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:ai_barcode/ai_barcode.dart';
The use of 'Camera' requires dynamic application permission, dynamic permission recommendation:permission_handler
Configure permissions
Android permission configuration:
<uses-permission android:name="android.permission.CAMERA"/>
iOS permission configuration:
<key>NSCameraUsageDescription</key>
<string>Can we access your camera in order to scan barcodes?</string>
iOS supports PlatformView configuration:
<key>io.flutter.embedded_views_preview</key>
<true/>
Brief example
//cameraWidth: the width of the camera;
//the height of the cameraHeight camera;
//which can be dynamically adjusted according to the actual business
Container(
color: Colors.black26,
width: cameraWidth,
height: cameraHeight,
child: PlatformAiBarcodeScannerWidget(
platformScannerController: _scannerController,
),
),
Complete example
*1、Turn on the camera device
_scannerController.startCamera();
*2、Open Preview / Recognize 'Barcode'
_scannerController.startCameraPreview();
*3、Close Preview / Recognize 'Barcode'
_scannerController.stopCameraPreview();
*4、Turn off camera equipment
_scannerController.stopCamera();
*5、Turn on the flashlight
_scannerController.openFlash();
*5、Flashlight off
_scannerController.closeFlash();
*5、Toggle flashlight
_scannerController.toggleFlash();
Seeing it here is overwhelming?Click to see project examples
iOS-Barcode/QRCode Scanner/Creator | Android-Barcode/QRCode Scanner/Creator | Web、MacOS-QrCode Creator |
---|---|---|
Built on: MTBBarcodeScanner | Built on: dm77/barcodescanner | Built on: qr_flutter |
:- | :- | :- |
- Support: Camera image can be frozen after successfully scanning barcode on iOS
BSD 3-Clause License
Copyright (c) 2020, pdliuw
All rights reserved.