Reading QR Codes from image file in Flutter
1,616
Use this package. You can pass the file and read the qr as expected.
Author by
Code With Bishal
Updated on January 01, 2023Comments
-
Code With Bishal over 1 year
I want to read Qr codes from picture files in flutter without using the firebase ML kit.
So far I was able to create the image picker but don't know what to do next.
Dependency:
image_picker: ^0.8.4+1
scan.dart:
File? _image; Container( child: Column( children: [ ElevatedButton.icon( style: ElevatedButton.styleFrom( primary: Theme.of(context).buttonColor), onPressed: () async => pickImage(), icon: Icon(Icons.image), label: Text("Choose an Image from gallery"), ) ], ), ); Future<void> pickImage() async { await Permission.storage.request(); var status = await Permission.storage.status; if (status.isGranted) { final pickedFile = await ImagePicker().pickImage(source: ImageSource.gallery); if (pickedFile != null) { setState( () { this._image = File(pickedFile.path); }, ); } } }
-
Code With Bishal over 2 yearsI have already tried using the package but the package does not have null safety and gives an error when I run it.
-
Kaushik Chandru over 2 yearspub.dev/packages/flutter_qr_scan/example This one is also good. It's null safe too
-
Code With Bishal over 2 yearsthe popularity of the package is not so good
-
Kaushik Chandru over 2 yearsEdited my answer. Please check
-
Code With Bishal over 2 yearsthe scan package worked please remove the previous answer so I can mark it as an answer
-
Kaushik Chandru over 2 yearsEdited my answer. Glad it worked :)