The sample demonstrates how to create a simple Flutter barcode plugin
with Dynamsoft Barcode Reader SDK.
Download the source code:
git clone https://github.com/yushulx/flutter-barcode-plugin.git
Get a free 30-day trial license and set it in demo\lib\main.dart
:
Future<void> initDynamsoftBarcodeReaderState() async {
_barcodeReader = BarcodeReader();
await _barcodeReader.initLicense('LICENSE-KEY');
}
Read barcodes from an image file:
await _controller.takePicture(path);
String results = await _barcodeReader.decodeFile(path);
Build and run the app:
Android
cd demo
flutter run -d <Android Device ID>
iOS
cd demo/ios
pod install
cd ..
flutter run -d <iOS Device ID>
To edit and improve the plugin:
Android
Import barcode_reader/example/android
to Android Studio
.
iOS
Import barcode_reader/example/ios/Runner.xcworkspace
to Xcode
.