flutter barcode & QR code scanner example
Codeplayon - Mobile App Development and Seo Company in Gurugram
Best Local Seo Digital Marketing Service, Mobile App Development, Ecommerce Seo, Saas Seo, Dentist Seo, in Gurgaon
Hi, Flutter developer in this?flutter article?I am sharing how to create a flutter barcode scanner app. As you know flutter is a cross-platform App development toolkit and for barcode scanning we need the camera hardware so both platform hardware configuration is different.
So I am using a flutter package for this integration?mobile_scanner??this is An universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS.
Platform-specific setup for?mobile_scanner
Android – flutter barcode & QR code scanner
This package makes use of the?included version?of MLKit Barcode-scanning that is compatible with Android.?This version is more precise and is immediately accessible to devices.?But, it will also increase the size of the application by 3-10 MB.
Another option is to utilize MLKit Barcode-scanning?non-bundled version?of MLKit Barcode scanner for Android.?This version is a bit older than the version that is bundled, but it only makes the file larger by about 600KB.?To use this version you must alter the mobile_scanner gradle file to replace?com.google.mlkit:barcode-scanning:17.0.2?with?com.google.android.gms:play-services-mlkit-barcode-scanning:18.0.0.
Be aware that if you change the gradle file directly within your project, it could be overridden when you update your pubspec.yaml.?I’m still looking for the best way to modify the module in Gradle however I am yet to find one.
领英推荐
iOS –?flutter barcode & QR code scanner
Add the following keys to your Info.plist file, located in?NSCameraUsageDescription – describe why your app needs access to the camera.?This is known as Privacy – Description of Camera Usage inside the Visual Editor.
If you want to use the local gallery feature from?image_picker?NSPhotoLibraryUsageDescription – describe why your app needs permission for the photo library.?This is known as Privacy – Photo library Usage description in the Visual Editor.
flutter barcode & QR code scanner example
Lets’s Start to make an example for a barcode and?QR code scanner example using with?mobile_scanner?package. So that firstly you can make a new project and if you have an old project where you want to add this open and follow bellow steps.