연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
MLKit Scanner
A Flutter plugin to detect barcodes, text, faces, and objects using Google MLKit API for iOS and Android
This Plugin uses Android CameraView library and iOS AVFoundation APIs for detecting objects from device's camera.
Note: This plugin is under development, and some APIs might not be available yet.
Features:
- Display camera preview in a widget.
- Set size of the camera preview.
- Set overlay for camera preview.
- Set area for detect object.
- Pause/Resume camera preview.
- Toogle device flash.
- Set a preview scale
- Use camera Zoom
- Lock autofocus
| Google MLKit APIs: |
Android |
iOS |
| Barcode scanning |
✅ |
✅ |
| ------------------------ |
- |
- |
Installation
First, add mlkit_scanner as a dependency in your pubspec.yaml.
iOS
iOS 11.0 of higher is needed to use the camera plugin.
Add key to the ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>...description...</string>
Android
Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.
minSdkVersion 21
Example
import 'package:mlkit_scanner/mlkit_scanner.dart';
...
return SizedBox(
height: 200.0
child: BarcodeScanner(
cropOverlay: ScannerCropOverlay
onScannerInitialized: _onScannerInitialized
onCameraInitializeError: (error) {
}
onScan: (barcode) {
},
),
);
Future<void> _onScannerInitialized(BarcodeScannerController controller) async {
await controller.startScan(100)
await controller.stopScan()
await controller.setDelay(200)
await controller.toggleFlash()
await controller.pauseCamera()
await controller.resumeCamera()
await controller.setZoom(0.5)
}
Contributing:
Contributions are welcome.