Dart module for communicating with the Veryfi OCR API
Dart module for communicating with the Veryfi OCR API
Installation
Install from https://pub.dev/packages/veryfi_dart
Getting Started
Obtaining Client ID and user keys
If you don’t have an account with Veryfi, please go ahead and register here: https://hub.veryfi.com/signup/api/
Veryfi Dart Client Library
The veryfi library can be used to communicate with Veryfi API. All available functionality is described here: https://veryfi.github.io/veryfi-dart/
Below is the sample Dart code using veryfi to OCR and extract data from a document:
Import package:
import 'package:veryfi_dart/veryfi_dart.dart';
Process a document from file
Future<void> processDocument() async {
String fileName = 'receipt.jpg';
File file = File(fileName);
Uint8List imageData = file.readAsBytesSync();
String fileData = base64Encode(imageData);
VeryfiDart client = VeryfiDart(
'yourClientId', 'yourClientSecret', 'yourUsername', 'yourApiKey');
await client.processDocument(fileName, fileData).then(
(response) {
print('success');
},
).catchError((error) {
print('error');
});
}
Update a document
Future<void> updateDocument() async {
VeryfiDart client = VeryfiDart(
'yourClientId', 'yourClientSecret', 'yourUsername', 'yourApiKey');
final Map<String, dynamic> params = {'notes': 'Test'};
await client.updateDocument('123', params).then(
(response) {
print('success');
},
).catchError((error) {
print('error');
});
}
Release
- Create new branch for your code
- Change version in
constants.dart
andpubspec.yaml
with the same version. - Commit changes and push to Github
- Create PR pointing to master branch and add a Veryfi member as a reviewer
- Tag your commit with the new version
- The new version will be accesible through Pub Dev.
Need help?
If you run into any issue or need help installing or using the library, please contact support@veryfi.com.
If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!
To learn more about Veryfi visit https://www.veryfi.com/