ml_card_scanner 0.0.1
ml_card_scanner: ^0.0.1 copied to clipboard
Package for scanning bank credit cards.
ml_ card_scanner #
The ml_ card_scanner plugin allows you to scan bank cards of different types: horizontal or vertical
Features #
- Powered by Google's Machine Learning models
- Great performance and accuracy
- Fully OFFLINE scan makes it a completely secure scanner.
- Can scan expiration date, card type and card number
Prepare #
Android
- Add these to
android/grade.propertiesfile:
android.useAndroidX=true
android.enableJetifier=true
- In
android/app/build.gradlefile:
android {
compileSdkVersion 30 // Set this to at least 30
...
}
- Add the permission to
android/app/src/main/AndroidManifest.xmlfile
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<uses-permission android:name="android.permission.CAMERA"/>
...
</manifest>
IOS
info.list
<key>NSCameraUsageDescription</key>
<string>Your Description</string>
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
You must list permission you want to use in your application
Add the following to your Podfile file:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
... # Here are some configurations automatically generated by flutter
# You can enable the permissions needed here. For example to enable camera
# permission, just remove the `#` character in front so it looks like this:
#
# ## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1'
#
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
]
end
end
end
Usage #
Just import the package and call ml_card_scanner an use ScannerWidget in your code:
ScannerWidget(controller: _controller)
Also ScannerWidget have another parameter you can specify:
overlay- set your overlay widget or specify null to use the default;overlayText- set your text widget or specify null to use the default;scannerDelay- set the scan delay or not set to use the default 400 (interval between card scannings in millisecconds);oneShotScanning- set tofalse- the scan will run continuously,true-scaninng will stop after card detected;overlayOrientation- set the default overlay orientation, by defaultportrait;controller-ScannerWidgetControllerwidget controller to get scanned card details or error;
For ScannerWidgetController have functionality:
- enable or disable scanning;
- enable or disable camera preview;
- set
onCardScannedcallback; - set
onErrorcallback;
Example Output :
Number card: 5173949390587465
Type: Master Card
Expiry: 10/24