A document scanner plugin for Android.
This plugin is built for android for now. Scan the document and you would get the image of the document
dependencies:
scanny: ^0.0.1
flutter pub get
Instantiate Scanny plugin and pass it to any custom widget
Instantiate the Scanny plugin
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState(new Scanny());
}
- askPermissions - for asking camera and storage permissions
- callScanner - This will instiate the scanner activity of the android
Future<void> askPermissions() async {
await scanny.askPermissions;
}
Use this method to initiate the scanning activity
dynamic _imageBytes;
Future<void> scanDocument() async {
try {
//ask permissions if permissions are not granted yet
await askPermissions();
//call the scanner
scanny.callScanner;
//listen to the results of activity
scanny.getImageBytes.listen((imageBytes){
setState(() {
_imageBytes = imageBytes;
});
});
}
catch(error) {
print(error);
}
}
We get the image results in the form of imageBytes so we store them in dynamic datatype for the sake of simplicity
scanny.getImageBytes.listen((imageBytes){
setState(() {
_imageBytes = imageBytes;
});
});
Displaying of the returned images can be done using Image.memory
widget.
Image.memory(_imageBytes)
The example flutter contains main.dart file. Please refer if get stuck along the way or ping me so that I can look into it.
Do Create pull and contribute. If you face any issues, please to create an issue.
- Add IOS scanner (Major)
- Add passport scanning functionality
I would really like to thank
- https://github.com/Credntia/CVScanner for this wonderful scanner
- https://github.com/Diastorm/rn-doc-scanner-android
GNU General Public License v3.0 Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.