fluttervisionsdkplugin 0.0.7 fluttervisionsdkplugin: ^0.0.7 copied to clipboard
A Flutter plugin package for integrating the Flutter Vision SDK into your Flutter application for scanning Barcodes and QrCodes
Flutter Vision SDK Plugin #
A Flutter plugin package for seamless integration of the Flutter Vision SDK into your Flutter applications. This package provides features for scanning barcodes, QR codes, and text, along with OCR (Optical Character Recognition) support. Customize scan and capture modes to meet your specific needs.
Features #
Scan barcodes, QR codes, and text. Optical Character Recognition (OCR) support. Flexible customization of scan and capture modes.
Getting started #
import the package and use it in your app.
import 'package:fluttervisionsdkplugin/fluttervisionsdkplugin.dart';
Native Doccumentation #
iOS Documentation #
- To see the iOS documentation you can visit here to see the details of each feature and their configuration parameters
Android Documentation #
- To see the iOS documentation you can visit here to see the details of each feature and their configuration parameters
Usage #
Here's an example of how to use the NativeViewWidget in your Flutter application:
NativeViewWidget(
onScanError: _onScanError,
onCodesReceived: _onCodesReceived,
onDetectionResult: _onDetectionResult,
onOCRImagesReceived: _onOCRImagesReceived,
apiKey:
'key_stag_123ABC.........K',
environment: Environment.prod,
onViewCreated: (communicator) =>
this.communicator = communicator,
listener: MainNativeViewWidgetListener(this),
shouldDisplayFocusImage: true,
shouldScanInFocusImageRect: true,
onDetected: onDetected,
isTextIndicationOn: true,
isBarCodeOrQRCodeIndicationOn: true,
selectionTintColor: 'white',
imageTintColor: 'white',
codeDetectionConfidence: 0.5,
sessionPreset: 'high',
nthFrameToProcess: 10,
captureMode: 0,
captureType: 0,
scanMode: 0,
focusImage: '',
focusImageRect: const {
'x': 0,
'y': 0,
'height': 0,
'width': 0,
}),
User can make the Barcode or Qrcode window customizable by giving values here :
focusImageRect: const {
'x': 0,
'y': 0,
'height': 0,
'width': 0,
}
This will show us either the detected type is Text, QrCode or BarCode:
Text(
'Detected Type: $scannedType',
style: const TextStyle(color: Colors.black, fontSize: 16),
),
This will show us the scanned code from barCode and QrCode:
Text(
'Scanned Code: $scannedCode',
style:
const TextStyle(color: Colors.black, fontSize: 16),
),
This will change the scanning mode to Auto:
Platform.isIOS
? ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeCaptureMode('auto');
},
child: const Text('Auto'),
)
: Expanded(
child: RadioListTile(
value: true,
title: const Text('Auto'),
groupValue: isAutoScanning,
onChanged: (i) {
setState(() {
isAutoScanning = true;
});
communicator?.setScanMode(1);
updateCaptureMode(false);
}),
),
This will change the scanning mode to Manual:
Platform.isIOS
? ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeCaptureMode('manual');
updateCaptureMode(true);
},
child: const Text('Manual'),
)
: Expanded(
child: RadioListTile(
value: false,
title: const Text('Manual'),
groupValue: isAutoScanning,
onChanged: (i) {
setState(() {
isAutoScanning = false;
});
communicator?.setScanMode(2);
updateCaptureMode(true);
}),
),
This will change the Scan Mode to Barcode:
Platform.isIOS
? ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('barcode');
},
child: const Text('Barcode'),
)
: Expanded(
flex: 1,
child: RadioListTile(
value: 1,
title: const Text('Barcode'),
groupValue: scanMode,
onChanged: (i) {
setState(() {
scanMode = 1;
});
communicator?.setCaptureModeBarcode();
}),
),
This will change the Scan Mode to QR:
Platform.isIOS
? ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('qrcode');
},
child: const Text(' QR Code'),
)
: Expanded(
flex: 1,
child: RadioListTile(
value: 2,
title: const Text('Qrcode'),
groupValue: scanMode,
onChanged: (i) {
setState(() {
scanMode = 2;
});
communicator?.setCaptureModeQrCode();
}),
),
This will change the Scan Mode to OCR:
Expanded(
flex: 1,
child: RadioListTile(
value: 3,
title: const Text('OCR'),
groupValue: scanMode,
onChanged: (i) {
setState(() {
scanMode = 3;
});
communicator?.setCaptureModeOCR();
}),
),
Platform.isIOS
? ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('ocr');
},
child: const Text('OCR'),
)
Additional information #
Users can import this package and integrate it into their Flutter projects to enable barcode and QR code scanning with customizable modes. This package provides a simple and efficient way to leverage the power of the Flutter Vision SDK in your applications.
For ios installation you need to install the pods again
For android add the below code in setting.gradle:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
Add the below line in android->build.gradle->inside repositories and all projects.
maven { url "https://jitpack.io" }
Set the below versions minSdkVersion 21 targetSdkVersion 33 in android->app->build.gradle.