easy_qr_scanner 0.0.2
easy_qr_scanner: ^0.0.2 copied to clipboard
A Flutter package for scanning QR codes using camera or image gallery.
easy_qr_scanner #
A Flutter package that provides a complete QR code scanning experience using the device's camera or image gallery. Built on top of mobile_scanner
, this package includes a fully featured UI and supports scanning from images as well.
✨ Features #
- Scan QR codes using the camera in real-time.
- Pick an image from the gallery and scan for QR codes.
- Torch/Flash control for low-light environments.
- Custom scan animation and styled scanner frame.
- Ready-to-use screen widget (
QRCodeScannerScreen
) with one-liner integration.
See the example for runnable example and usages, such as the basic usage.
🚀 Getting Started #
Installation #
Add this to your pubspec.yaml
:
dependencies:
easy_qr_scanner: ^<latest_version>
Then run:
flutter pub get
Configuration #
Android #
To use the mobile_scanner
plugin with the unbundled CameraX implementation, add the following line to your android/gradle.properties
file:
dev.steenbakker.mobile_scanner.useUnbundled=true
Ios #
Since the scanner needs to use the camera, add the following keys to your Info.plist file. (located in
NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor.
If you want to use the local gallery feature from image_picker, you also need to add the following key.
NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
Example,
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan QR codes</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs photos access to get QR code from photo library</string>
Usage #
import 'package:qr_code_scanner/qr_code_scanner.dart';
...
ElevatedButton(
onPressed: () async {
final result =await easyScanQRCode(context,title: "Find a QR code and scan it",
scanWindowBorderColor: Colors.green,
titleStyle: Theme.of(context).textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w700,
fontSize: 11,
color: Colors.amber,
));
print("Scanned QR Code: $result");
},
child: const Text("Scan QR Code"),
),