diff --git a/BlinkCard/android/build.gradle b/BlinkCard/android/build.gradle
index 8e30716..919e860 100644
--- a/BlinkCard/android/build.gradle
+++ b/BlinkCard/android/build.gradle
@@ -34,7 +34,7 @@ android {
}
dependencies {
- implementation('com.microblink:blinkcard:2.3.0@aar') {
+ implementation('com.microblink:blinkcard:2.4.0@aar') {
transitive = true
}
}
diff --git a/BlinkCard/android/src/main/AndroidManifest.xml b/BlinkCard/android/src/main/AndroidManifest.xml
index a46f1ec..ea9fb41 100644
--- a/BlinkCard/android/src/main/AndroidManifest.xml
+++ b/BlinkCard/android/src/main/AndroidManifest.xml
@@ -1,3 +1,11 @@
+
+
+
+
+
+
diff --git a/BlinkCard/ios/Classes/MicroblinkModule/Overlays/Serialization/MBBlinkCardOverlaySettingsSerialization.m b/BlinkCard/ios/Classes/MicroblinkModule/Overlays/Serialization/MBBlinkCardOverlaySettingsSerialization.m
index 0333c47..1b73320 100644
--- a/BlinkCard/ios/Classes/MicroblinkModule/Overlays/Serialization/MBBlinkCardOverlaySettingsSerialization.m
+++ b/BlinkCard/ios/Classes/MicroblinkModule/Overlays/Serialization/MBBlinkCardOverlaySettingsSerialization.m
@@ -6,6 +6,7 @@
//
#import "MBBlinkCardOverlaySettingsSerialization.h"
+#import "MBOverlaySerializationUtils.h"
@interface MBCBlinkCardOverlaySettingsSerialization ()
@@ -30,6 +31,7 @@ -(MBCOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOv
MBCBlinkCardOverlaySettings *sett = [[MBCBlinkCardOverlaySettings alloc] init];
self.delegate = delegate;
sett.enableEditScreen = NO;
+ [MBCOverlaySerializationUtils extractCommonOverlaySettings:jsonOverlaySettings overlaySettings:sett];
{
id glareMessage = [jsonOverlaySettings valueForKey:@"glareMessage"];
diff --git a/BlinkCard/ios/blinkcard_flutter.podspec b/BlinkCard/ios/blinkcard_flutter.podspec
index 6799b83..6721ffb 100644
--- a/BlinkCard/ios/blinkcard_flutter.podspec
+++ b/BlinkCard/ios/blinkcard_flutter.podspec
@@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'blinkcard_flutter'
- s.version = '2.3.0'
+ s.version = '2.4.0'
s.summary = 'Flutter plugin for BlinkCard, SDK for scanning and OCR of various credit cards.'
s.description = <<-DESC
Flutter plugin for BlinkCard, SDK for scanning and OCR of various credit cards.
@@ -18,7 +18,7 @@ Flutter plugin for BlinkCard, SDK for scanning and OCR of various credit cards.
s.dependency 'Flutter'
s.platform = :ios, '9.0'
- s.dependency 'MBBlinkCard', '~> 2.3.0'
+ s.dependency 'MBBlinkCard', '~> 2.4.0'
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
diff --git a/BlinkCard/lib/microblink_scanner.dart b/BlinkCard/lib/microblink_scanner.dart
index e792a6a..8bff34e 100644
--- a/BlinkCard/lib/microblink_scanner.dart
+++ b/BlinkCard/lib/microblink_scanner.dart
@@ -34,7 +34,7 @@ class MicroblinkScanner {
})
);
- if (jsonResults == null) return List(0);
+ if (jsonResults == null) return List.empty();
var results = [];
for (int i = 0; i < jsonResults.length; ++i) {
diff --git a/BlinkCard/lib/overlay_settings.dart b/BlinkCard/lib/overlay_settings.dart
index edf3e5e..4f28ef3 100644
--- a/BlinkCard/lib/overlay_settings.dart
+++ b/BlinkCard/lib/overlay_settings.dart
@@ -6,27 +6,26 @@ part 'overlay_settings.g.dart';
/// Base class for all overlay settings objects
@JsonSerializable()
class OverlaySettings {
+ /// type of the overlay settings object
+ String? overlaySettingsType;
- /// type of the overlay settings object
- String overlaySettingsType;
-
- /// whether front camera should be used instead of the default camera
+ /// whether front camera should be used instead of the default camera
+ /// false by default
bool useFrontCamera = false;
- /// whether beep sound will be played on successful scan
+ /// whether beep sound will be played on successful scan
+ /// false by default
bool enableBeep = false;
/// (optional) if default overlay contains textual information, text will be localized to this language. Otherwise device langauge will be used
/// example: "en"
- String language;
+ String? language;
/// (optional) to be used with language variable, it defines the country locale
/// example: "US" to use "en_US" on Android and en-US on iOS
- String country;
+ String? country;
- OverlaySettings(String overlaySettingsType) {
- this.overlaySettingsType = overlaySettingsType;
- }
+ OverlaySettings(this.overlaySettingsType);
factory OverlaySettings.fromJson(Map json) => _$OverlaySettingsFromJson(json);
diff --git a/BlinkCard/lib/overlay_settings.g.dart b/BlinkCard/lib/overlay_settings.g.dart
index dcf6be1..0e49d46 100644
--- a/BlinkCard/lib/overlay_settings.g.dart
+++ b/BlinkCard/lib/overlay_settings.g.dart
@@ -8,12 +8,12 @@ part of 'overlay_settings.dart';
OverlaySettings _$OverlaySettingsFromJson(Map json) {
return OverlaySettings(
- json['overlaySettingsType'] as String,
+ json['overlaySettingsType'] as String?,
)
..useFrontCamera = json['useFrontCamera'] as bool
..enableBeep = json['enableBeep'] as bool
- ..language = json['language'] as String
- ..country = json['country'] as String;
+ ..language = json['language'] as String?
+ ..country = json['country'] as String?;
}
Map _$OverlaySettingsToJson(OverlaySettings instance) =>
diff --git a/BlinkCard/lib/overlays/blinkcard_overlays.dart b/BlinkCard/lib/overlays/blinkcard_overlays.dart
index 700d84c..0578236 100644
--- a/BlinkCard/lib/overlays/blinkcard_overlays.dart
+++ b/BlinkCard/lib/overlays/blinkcard_overlays.dart
@@ -10,16 +10,16 @@ class BlinkCardOverlaySettings extends OverlaySettings {
/// String: user instructions that are shown above camera preview while the first side of the
/// document is being scanned.
/// If null, default value will be used.
- String firstSideInstructions;
+ String? firstSideInstructions;
/// String: user instructions that are shown above camera preview while the second side of the
/// document is being scanned.
/// If null, default value will be used.
- String flipCardInstructions;
+ String? flipCardInstructions;
/// Defines whether glare warning will be displayed when user turn on a flashlight
/// Default true
- bool showFlashlightWarning;
+ bool showFlashlightWarning = true;
BlinkCardOverlaySettings(): super('BlinkCardOverlaySettings');
diff --git a/BlinkCard/lib/overlays/blinkcard_overlays.g.dart b/BlinkCard/lib/overlays/blinkcard_overlays.g.dart
index 8decabe..81685bd 100644
--- a/BlinkCard/lib/overlays/blinkcard_overlays.g.dart
+++ b/BlinkCard/lib/overlays/blinkcard_overlays.g.dart
@@ -9,13 +9,13 @@ part of 'blinkcard_overlays.dart';
BlinkCardOverlaySettings _$BlinkCardOverlaySettingsFromJson(
Map json) {
return BlinkCardOverlaySettings()
- ..overlaySettingsType = json['overlaySettingsType'] as String
+ ..overlaySettingsType = json['overlaySettingsType'] as String?
..useFrontCamera = json['useFrontCamera'] as bool
..enableBeep = json['enableBeep'] as bool
- ..language = json['language'] as String
- ..country = json['country'] as String
- ..firstSideInstructions = json['firstSideInstructions'] as String
- ..flipCardInstructions = json['flipCardInstructions'] as String
+ ..language = json['language'] as String?
+ ..country = json['country'] as String?
+ ..firstSideInstructions = json['firstSideInstructions'] as String?
+ ..flipCardInstructions = json['flipCardInstructions'] as String?
..showFlashlightWarning = json['showFlashlightWarning'] as bool;
}
diff --git a/BlinkCard/lib/recognizer.dart b/BlinkCard/lib/recognizer.dart
index 736587a..c1ecb33 100644
--- a/BlinkCard/lib/recognizer.dart
+++ b/BlinkCard/lib/recognizer.dart
@@ -15,11 +15,11 @@ class Recognizer {
/// Type of recognizer
String recognizerType;
- Recognizer(String recognizerType) {
- this.recognizerType = recognizerType;
- }
+ Recognizer(this.recognizerType);
- RecognizerResult createResultFromNative(Map nativeResult) {}
+ RecognizerResult createResultFromNative(Map nativeResult) {
+ return RecognizerResult(nativeResult['resultState']);
+ }
factory Recognizer.fromJson(Map json) => _$RecognizerFromJson(json);
@@ -45,9 +45,7 @@ class RecognizerResult {
/// State of the result. It is always one of the values represented by RecognizerResultState enum
RecognizerResultState resultState;
- RecognizerResult(RecognizerResultState resultState) {
- this.resultState = resultState;
- }
+ RecognizerResult(this.resultState);
factory RecognizerResult.fromJson(Map json) => _$RecognizerResultFromJson(json);
@@ -63,9 +61,7 @@ class RecognizerCollection {
int milisecondsBeforeTimeout = 10000;
- RecognizerCollection(List recognizerArray) {
- this.recognizerArray = recognizerArray;
- }
+ RecognizerCollection(this.recognizerArray);
factory RecognizerCollection.fromJson(Map json) => _$RecognizerCollectionFromJson(json);
diff --git a/BlinkCard/lib/recognizer.g.dart b/BlinkCard/lib/recognizer.g.dart
index 168fc3f..6e4d18a 100644
--- a/BlinkCard/lib/recognizer.g.dart
+++ b/BlinkCard/lib/recognizer.g.dart
@@ -19,7 +19,7 @@ Map _$RecognizerToJson(Recognizer instance) =>
RecognizerResult _$RecognizerResultFromJson(Map json) {
return RecognizerResult(
- _$enumDecodeNullable(_$RecognizerResultStateEnumMap, json['resultState']),
+ _$enumDecode(_$RecognizerResultStateEnumMap, json['resultState']),
);
}
@@ -28,36 +28,30 @@ Map _$RecognizerResultToJson(RecognizerResult instance) =>
'resultState': _$RecognizerResultStateEnumMap[instance.resultState],
};
-T _$enumDecode(
- Map enumValues,
- dynamic source, {
- T unknownValue,
+K _$enumDecode(
+ Map enumValues,
+ Object? source, {
+ K? unknownValue,
}) {
if (source == null) {
- throw ArgumentError('A value must be provided. Supported values: '
- '${enumValues.values.join(', ')}');
+ throw ArgumentError(
+ 'A value must be provided. Supported values: '
+ '${enumValues.values.join(', ')}',
+ );
}
- final value = enumValues.entries
- .singleWhere((e) => e.value == source, orElse: () => null)
- ?.key;
-
- if (value == null && unknownValue == null) {
- throw ArgumentError('`$source` is not one of the supported values: '
- '${enumValues.values.join(', ')}');
- }
- return value ?? unknownValue;
-}
-
-T _$enumDecodeNullable(
- Map enumValues,
- dynamic source, {
- T unknownValue,
-}) {
- if (source == null) {
- return null;
- }
- return _$enumDecode(enumValues, source, unknownValue: unknownValue);
+ return enumValues.entries.singleWhere(
+ (e) => e.value == source,
+ orElse: () {
+ if (unknownValue == null) {
+ throw ArgumentError(
+ '`$source` is not one of the supported values: '
+ '${enumValues.values.join(', ')}',
+ );
+ }
+ return MapEntry(unknownValue, enumValues.values.first);
+ },
+ ).key;
}
const _$RecognizerResultStateEnumMap = {
@@ -69,10 +63,9 @@ const _$RecognizerResultStateEnumMap = {
RecognizerCollection _$RecognizerCollectionFromJson(Map json) {
return RecognizerCollection(
- (json['recognizerArray'] as List)
- ?.map((e) =>
- e == null ? null : Recognizer.fromJson(e as Map))
- ?.toList(),
+ (json['recognizerArray'] as List)
+ .map((e) => Recognizer.fromJson(e as Map))
+ .toList(),
)
..allowMultipleResults = json['allowMultipleResults'] as bool
..milisecondsBeforeTimeout = json['milisecondsBeforeTimeout'] as int;
diff --git a/BlinkCard/lib/recognizers/blink_card_recognizer.dart b/BlinkCard/lib/recognizers/blink_card_recognizer.dart
index 7258db5..a955179 100644
--- a/BlinkCard/lib/recognizers/blink_card_recognizer.dart
+++ b/BlinkCard/lib/recognizers/blink_card_recognizer.dart
@@ -8,52 +8,53 @@ part 'blink_card_recognizer.g.dart';
class BlinkCardRecognizerResult extends RecognizerResult {
///The payment card number.
- String cardNumber;
+ String? cardNumber;
///The payment card number prefix.
- String cardNumberPrefix;
+ String? cardNumberPrefix;
- ///Flag which indicatew whether the payment card number is valid or not.
- bool cardNumberValid;
+ ///The payment card number is valid
+ bool? cardNumberValid;
- ///Payment card's security code/value.
- String cvv;
+ /// Payment card's security code/value.
+ String? cvv;
- ///Defines digital signature of recognition results.
- String digitalSignature;
+ ///Digital signature of the recognition result. Available only if enabled with signResult property.
+ String? digitalSignature;
- ///Defines digital signature version.
- int digitalSignatureVersion;
+ ///Version of the digital signature. Available only if enabled with signResult property.
+ int? digitalSignatureVersion;
///The payment card's expiry date.
- Date expiryDate;
+ Date? expiryDate;
- ///Whether the first scanned side is blurred.
- bool firstSideBlurred;
+ ///Wheater the first scanned side is blurred.
+ bool? firstSideBlurred;
///Full image of the payment card from first side recognition.
- String firstSideFullDocumentImage;
+ String? firstSideFullDocumentImage;
///Payment card's IBAN.
- String iban;
+ String? iban;
///Payment card's issuing network.
- Issuer issuer;
+ Issuer? issuer;
- ///Information about the payment card owner.
- String owner;
+ ///Information about the payment card owner (name, company, etc.).
+ String? owner;
///Status of the last recognition process.
- BlinkCardProcessingStatus processingStatus;
+ BlinkCardProcessingStatus? processingStatus;
- ///{true} if recognizer has finished scanning first side and is now scanning back side,
- bool scanningFirstSideDone;
+ ///Returns true if recognizer has finished scanning first side and is now scanning back side,
+ /// false if it's still scanning first side.
+ bool? scanningFirstSideDone;
- ///Whether the second scanned side is blurred.
- bool secondSideBlurred;
+ ///Wheater the second scanned side is blurred.
+ bool? secondSideBlurred;
///Full image of the payment card from second side recognition.
- String secondSideFullDocumentImage;
+ String? secondSideFullDocumentImage;
BlinkCardRecognizerResult(Map nativeResult): super(RecognizerResultState.values[nativeResult['resultState']]) {
@@ -93,41 +94,67 @@ class BlinkCardRecognizerResult extends RecognizerResult {
}
-///Recognizer used for scanning both sides of payment cards.
+///Recognizer used for scanning credit/debit cards.
@JsonSerializable()
class BlinkCardRecognizer extends Recognizer {
- ///Whether blured frames filtering is allowed.
+ ///Defines whether blured frames filtering is allowed
+ ///
+ ///
bool allowBlurFilter = true;
- ///The settings which control the anonymization of returned data.
- BlinkCardAnonymizationSettings anonymizationSettings = new BlinkCardAnonymizationSettings();
+ ///Defines whether sensitive data should be redacted from the result.
+ ///
+ ///
+ BlinkCardAnonymizationSettings anonymizationSettings = BlinkCardAnonymizationSettings();
- ///Should extract the card CVV
+ ///Should extract CVV
+ ///
+ ///
bool extractCvv = true;
- ///Should extract the payment card's expiry date.
+ ///Should extract the payment card's month of expiry
+ ///
+ ///
bool extractExpiryDate = true;
- ///Should extract the card IBAN
+ ///Should extract the payment card's IBAN
+ ///
+ ///
bool extractIban = true;
///Should extract the card owner information
+ ///
+ ///
bool extractOwner = true;
- ///The DPI (Dots Per Inch) for full document image that should be returned.
+ ///Property for setting DPI for full document images
+ /// Valid ranges are [100,400]. Setting DPI out of valid ranges throws an exception
+ ///
+ ///
int fullDocumentImageDpi = 250;
- ///The extension factors for full document image.
+ ///Image extension factors for full document image.
+ ///
+ /// @see CImageExtensionFactors
+ ///
ImageExtensionFactors fullDocumentImageExtensionFactors = ImageExtensionFactors();
- ///Padding is a minimum distance from the edge of the frame and it is defined as a percentage
+ ///Pading is a minimum distance from the edge of the frame and is defined as a percentage of the frame width. Default value is 0.0f and in that case
+ /// padding edge and image edge are the same.
+ /// Recommended value is 0.02f.
+ ///
+ ///
double paddingEdge = 0.0;
- ///Defines whether full document image will be available in
+ ///Sets whether full document image of ID card should be extracted.
+ ///
+ ///
bool returnFullDocumentImage = false;
- ///Defines whether or not recognition result should be signed.
+ ///Whether or not recognition result should be signed.
+ ///
+ ///
bool signResult = false;
BlinkCardRecognizer(): super('BlinkCardRecognizer');
diff --git a/BlinkCard/lib/recognizers/blink_card_recognizer.g.dart b/BlinkCard/lib/recognizers/blink_card_recognizer.g.dart
index 0aa55df..d85fb41 100644
--- a/BlinkCard/lib/recognizers/blink_card_recognizer.g.dart
+++ b/BlinkCard/lib/recognizers/blink_card_recognizer.g.dart
@@ -10,22 +10,16 @@ BlinkCardRecognizer _$BlinkCardRecognizerFromJson(Map json) {
return BlinkCardRecognizer()
..recognizerType = json['recognizerType'] as String
..allowBlurFilter = json['allowBlurFilter'] as bool
- ..anonymizationSettings = json['anonymizationSettings'] == null
- ? null
- : BlinkCardAnonymizationSettings.fromJson(
- json['anonymizationSettings'] as Map)
+ ..anonymizationSettings = BlinkCardAnonymizationSettings.fromJson(
+ json['anonymizationSettings'] as Map)
..extractCvv = json['extractCvv'] as bool
..extractExpiryDate = json['extractExpiryDate'] as bool
..extractIban = json['extractIban'] as bool
..extractOwner = json['extractOwner'] as bool
..fullDocumentImageDpi = json['fullDocumentImageDpi'] as int
- ..fullDocumentImageExtensionFactors =
- json['fullDocumentImageExtensionFactors'] == null
- ? null
- : ImageExtensionFactors.fromJson(
- json['fullDocumentImageExtensionFactors']
- as Map)
- ..paddingEdge = (json['paddingEdge'] as num)?.toDouble()
+ ..fullDocumentImageExtensionFactors = ImageExtensionFactors.fromJson(
+ json['fullDocumentImageExtensionFactors'] as Map)
+ ..paddingEdge = (json['paddingEdge'] as num).toDouble()
..returnFullDocumentImage = json['returnFullDocumentImage'] as bool
..signResult = json['signResult'] as bool;
}
diff --git a/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.dart b/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.dart
index ee3fa69..e142769 100644
--- a/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.dart
+++ b/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.dart
@@ -8,37 +8,41 @@ part 'legacy_blink_card_elite_recognizer.g.dart';
class LegacyBlinkCardEliteRecognizerResult extends RecognizerResult {
///The payment card number.
- String cardNumber;
+ String? cardNumber;
- ///Payment card's security code/value.
- String cvv;
+ /// Payment card's security code/value
+ String? cvv;
- ///Defines digital signature of recognition results.
- String digitalSignature;
+ ///Digital signature of the recognition result. Available only if enabled with signResult property.
+ String? digitalSignature;
- ///Defines digital signature version.
- int digitalSignatureVersion;
+ ///Version of the digital signature. Available only if enabled with signResult property.
+ int? digitalSignatureVersion;
- ///Defines result of the data matching algorithm for scanned parts/sides of the document.
- DataMatchResult documentDataMatch;
+ ///Returns CDataMatchResultSuccess if data from scanned parts/sides of the document match,
+ /// CDataMatchResultFailed otherwise. For example if date of expiry is scanned from the front and back side
+ /// of the document and values do not match, this method will return CDataMatchResultFailed. Result will
+ /// be CDataMatchResultSuccess only if scanned values for all fields that are compared are the same.
+ DataMatchResult? documentDataMatch;
- ///Back side image of the document
- String fullDocumentBackImage;
+ ///back side image of the document if enabled with returnFullDocumentImage property.
+ String? fullDocumentBackImage;
- ///Front side image of the document
- String fullDocumentFrontImage;
+ ///front side image of the document if enabled with returnFullDocumentImage property.
+ String? fullDocumentFrontImage;
///Payment card's inventory number.
- String inventoryNumber;
+ String? inventoryNumber;
- ///Information about the payment card owner (name, company, etc.)
- String owner;
+ ///Information about the payment card owner (name, company, etc.).
+ String? owner;
- ///{true} if recognizer has finished scanning first side and is now scanning back side,
- bool scanningFirstSideDone;
+ ///Returns true if recognizer has finished scanning first side and is now scanning back side,
+ /// false if it's still scanning first side.
+ bool? scanningFirstSideDone;
///The payment card's last month of validity.
- Date validThru;
+ Date? validThru;
LegacyBlinkCardEliteRecognizerResult(Map nativeResult): super(RecognizerResultState.values[nativeResult['resultState']]) {
@@ -68,41 +72,65 @@ class LegacyBlinkCardEliteRecognizerResult extends RecognizerResult {
}
-///Recognizer used for scanning both sides of elite payment cards.
+///Recognizer used for scanning the front side of elite credit/debit cards.
@JsonSerializable()
class LegacyBlinkCardEliteRecognizer extends Recognizer {
///Should anonymize the card number area (redact image pixels) on the document image result
+ ///
+ ///
bool anonymizeCardNumber = false;
- ///Should anonymize the CVV area (redact image pixels) on the document image result
+ ///Should anonymize the CVV on the document image result
+ ///
+ ///
bool anonymizeCvv = false;
///Should anonymize the owner area (redact image pixels) on the document image result
+ ///
+ ///
bool anonymizeOwner = false;
- ///Defines whether glare detector is enabled.
+ ///Defines if glare detection should be turned on/off.
+ ///
+ ///
bool detectGlare = true;
///Should extract the card's inventory number
+ ///
+ ///
bool extractInventoryNumber = true;
///Should extract the card owner information
+ ///
+ ///
bool extractOwner = true;
///Should extract the payment card's month of expiry
+ ///
+ ///
bool extractValidThru = true;
- ///The DPI (Dots Per Inch) for full document image that should be returned.
+ ///Property for setting DPI for full document images
+ /// Valid ranges are [100,400]. Setting DPI out of valid ranges throws an exception
+ ///
+ ///
int fullDocumentImageDpi = 250;
- ///The extension factors for full document image.
+ ///Image extension factors for full document image.
+ ///
+ /// @see CImageExtensionFactors
+ ///
ImageExtensionFactors fullDocumentImageExtensionFactors = ImageExtensionFactors();
- ///Defines whether full document image will be available in
+ ///Sets whether full document image of ID card should be extracted.
+ ///
+ ///
bool returnFullDocumentImage = false;
- ///Defines whether or not recognition result should be signed.
+ ///Whether or not recognition result should be signed.
+ ///
+ ///
bool signResult = false;
LegacyBlinkCardEliteRecognizer(): super('LegacyBlinkCardEliteRecognizer');
diff --git a/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.g.dart b/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.g.dart
index 83dd0c7..5a84df2 100644
--- a/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.g.dart
+++ b/BlinkCard/lib/recognizers/legacy_blink_card_elite_recognizer.g.dart
@@ -18,12 +18,8 @@ LegacyBlinkCardEliteRecognizer _$LegacyBlinkCardEliteRecognizerFromJson(
..extractOwner = json['extractOwner'] as bool
..extractValidThru = json['extractValidThru'] as bool
..fullDocumentImageDpi = json['fullDocumentImageDpi'] as int
- ..fullDocumentImageExtensionFactors =
- json['fullDocumentImageExtensionFactors'] == null
- ? null
- : ImageExtensionFactors.fromJson(
- json['fullDocumentImageExtensionFactors']
- as Map)
+ ..fullDocumentImageExtensionFactors = ImageExtensionFactors.fromJson(
+ json['fullDocumentImageExtensionFactors'] as Map)
..returnFullDocumentImage = json['returnFullDocumentImage'] as bool
..signResult = json['signResult'] as bool;
}
diff --git a/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.dart b/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.dart
index d76132a..b86bba5 100644
--- a/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.dart
+++ b/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.dart
@@ -8,43 +8,47 @@ part 'legacy_blink_card_recognizer.g.dart';
class LegacyBlinkCardRecognizerResult extends RecognizerResult {
///The payment card number.
- String cardNumber;
+ String? cardNumber;
- ///Payment card's security code/value.
- String cvv;
+ /// Payment card's security code/value
+ String? cvv;
- ///Defines digital signature of recognition results.
- String digitalSignature;
+ ///Digital signature of the recognition result. Available only if enabled with signResult property.
+ String? digitalSignature;
- ///Defines digital signature version.
- int digitalSignatureVersion;
+ ///Version of the digital signature. Available only if enabled with signResult property.
+ int? digitalSignatureVersion;
- ///Defines result of the data matching algorithm for scanned parts/sides of the document.
- DataMatchResult documentDataMatch;
+ ///Returns CDataMatchResultSuccess if data from scanned parts/sides of the document match,
+ /// CDataMatchResultFailed otherwise. For example if date of expiry is scanned from the front and back side
+ /// of the document and values do not match, this method will return CDataMatchResultFailed. Result will
+ /// be CDataMatchResultSuccess only if scanned values for all fields that are compared are the same.
+ DataMatchResult? documentDataMatch;
- ///Back side image of the document
- String fullDocumentBackImage;
+ ///back side image of the document if enabled with returnFullDocumentImage property.
+ String? fullDocumentBackImage;
- ///Front side image of the document
- String fullDocumentFrontImage;
+ ///front side image of the document if enabled with returnFullDocumentImage property.
+ String? fullDocumentFrontImage;
- ///Payment card's IBAN.
- String iban;
+ ///Payment card's IBAN
+ String? iban;
///Payment card's inventory number.
- String inventoryNumber;
+ String? inventoryNumber;
- ///The payment card's issuing network.
- LegacyCardIssuer issuer;
+ ///Payment card's issuing network
+ LegacyCardIssuer? issuer;
- ///Information about the payment card owner (name, company, etc.)
- String owner;
+ ///Information about the payment card owner (name, company, etc.).
+ String? owner;
- ///{true} if recognizer has finished scanning first side and is now scanning back side,
- bool scanningFirstSideDone;
+ ///Returns true if recognizer has finished scanning first side and is now scanning back side,
+ /// false if it's still scanning first side.
+ bool? scanningFirstSideDone;
///The payment card's last month of validity.
- Date validThru;
+ Date? validThru;
LegacyBlinkCardRecognizerResult(Map nativeResult): super(RecognizerResultState.values[nativeResult['resultState']]) {
@@ -78,50 +82,80 @@ class LegacyBlinkCardRecognizerResult extends RecognizerResult {
}
-///Recognizer used for scanning both sides of payment cards.
+///Recognizer used for scanning the front side of credit/debit cards.
@JsonSerializable()
class LegacyBlinkCardRecognizer extends Recognizer {
///Should anonymize the card number area (redact image pixels) on the document image result
+ ///
+ ///
bool anonymizeCardNumber = false;
- ///Should anonymize the CVV area (redact image pixels) on the document image result
+ ///Should anonymize the CVV on the document image result
+ ///
+ ///
bool anonymizeCvv = false;
///Should anonymize the IBAN area (redact image pixels) on the document image result
+ ///
+ ///
bool anonymizeIban = false;
///Should anonymize the owner area (redact image pixels) on the document image result
+ ///
+ ///
bool anonymizeOwner = false;
- ///Defines whether glare detector is enabled.
+ ///Defines if glare detection should be turned on/off.
+ ///
+ ///
bool detectGlare = true;
- ///Should extract the card CVV
+ ///Should extract CVV
+ ///
+ ///
bool extractCvv = true;
- ///Should extract the card IBAN
+ ///Should extract the payment card's IBAN
+ ///
+ ///
bool extractIban = false;
///Should extract the card's inventory number
+ ///
+ ///
bool extractInventoryNumber = true;
///Should extract the card owner information
+ ///
+ ///
bool extractOwner = false;
///Should extract the payment card's month of expiry
+ ///
+ ///
bool extractValidThru = true;
- ///The DPI (Dots Per Inch) for full document image that should be returned.
+ ///Property for setting DPI for full document images
+ /// Valid ranges are [100,400]. Setting DPI out of valid ranges throws an exception
+ ///
+ ///
int fullDocumentImageDpi = 250;
- ///The extension factors for full document image.
+ ///Image extension factors for full document image.
+ ///
+ /// @see CImageExtensionFactors
+ ///
ImageExtensionFactors fullDocumentImageExtensionFactors = ImageExtensionFactors();
- ///Defines whether full document image will be available in
+ ///Sets whether full document image of ID card should be extracted.
+ ///
+ ///
bool returnFullDocumentImage = false;
- ///Defines whether or not recognition result should be signed.
+ ///Whether or not recognition result should be signed.
+ ///
+ ///
bool signResult = false;
LegacyBlinkCardRecognizer(): super('LegacyBlinkCardRecognizer');
diff --git a/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.g.dart b/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.g.dart
index edb3644..81bb851 100644
--- a/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.g.dart
+++ b/BlinkCard/lib/recognizers/legacy_blink_card_recognizer.g.dart
@@ -21,12 +21,8 @@ LegacyBlinkCardRecognizer _$LegacyBlinkCardRecognizerFromJson(
..extractOwner = json['extractOwner'] as bool
..extractValidThru = json['extractValidThru'] as bool
..fullDocumentImageDpi = json['fullDocumentImageDpi'] as int
- ..fullDocumentImageExtensionFactors =
- json['fullDocumentImageExtensionFactors'] == null
- ? null
- : ImageExtensionFactors.fromJson(
- json['fullDocumentImageExtensionFactors']
- as Map)
+ ..fullDocumentImageExtensionFactors = ImageExtensionFactors.fromJson(
+ json['fullDocumentImageExtensionFactors'] as Map)
..returnFullDocumentImage = json['returnFullDocumentImage'] as bool
..signResult = json['signResult'] as bool;
}
diff --git a/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.dart b/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.dart
index dba1943..e6f2851 100644
--- a/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.dart
+++ b/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.dart
@@ -7,18 +7,15 @@ part 'success_frame_grabber_recognizer.g.dart';
class SuccessFrameGrabberRecognizerResult extends RecognizerResult {
/// Camera frame at the time slave recognizer finished recognition
- String successFrame;
+ String? successFrame;
/// RecognizerResult of the slave recognizer
RecognizerResult slaveRecognizerResult;
- SuccessFrameGrabberRecognizerResult(Map nativeResult, RecognizerResult slaveRecognizerResult): super(RecognizerResultState.values[nativeResult['resultState']]) {
+ SuccessFrameGrabberRecognizerResult(Map nativeResult, this.slaveRecognizerResult): super(RecognizerResultState.values[nativeResult['resultState']]) {
/// Camera frame at the time slave recognizer finished recognition
this.successFrame = nativeResult['successFrame'];
-
- /// RecognizerResult of the slave recognizer
- this.slaveRecognizerResult = slaveRecognizerResult;
}
}
@@ -29,8 +26,7 @@ class SuccessFrameGrabberRecognizer extends Recognizer {
Recognizer slaveRecognizer;
- SuccessFrameGrabberRecognizer(Recognizer slaveRecognizer): super('SuccessFrameGrabberRecognizer') {
- this.slaveRecognizer = slaveRecognizer;
+ SuccessFrameGrabberRecognizer(this.slaveRecognizer): super('SuccessFrameGrabberRecognizer') {
if (!(this.slaveRecognizer is Recognizer)) {
throw Exception("Slave recognizer must be Recognizer!");
diff --git a/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.g.dart b/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.g.dart
index 0544d17..959ca4c 100644
--- a/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.g.dart
+++ b/BlinkCard/lib/recognizers/success_frame_grabber_recognizer.g.dart
@@ -9,9 +9,7 @@ part of 'success_frame_grabber_recognizer.dart';
SuccessFrameGrabberRecognizer _$SuccessFrameGrabberRecognizerFromJson(
Map json) {
return SuccessFrameGrabberRecognizer(
- json['slaveRecognizer'] == null
- ? null
- : Recognizer.fromJson(json['slaveRecognizer'] as Map),
+ Recognizer.fromJson(json['slaveRecognizer'] as Map),
)..recognizerType = json['recognizerType'] as String;
}
diff --git a/BlinkCard/lib/types.dart b/BlinkCard/lib/types.dart
index 1c46c25..32733e9 100644
--- a/BlinkCard/lib/types.dart
+++ b/BlinkCard/lib/types.dart
@@ -5,11 +5,11 @@ part 'types.g.dart';
class Date {
/// day in month
- int day;
+ int? day;
/// month in year
- int month;
+ int? month;
/// year
- int year;
+ int? year;
Date(Map nativeDate) {
this.day = nativeDate['day'];
@@ -22,13 +22,14 @@ class Date {
class Point {
/// x coordinate of the point
- double x;
+ double? x;
/// y coordinate of the point
- double y;
+ double? y;
Point(Map nativePoint) {
- this.x = nativePoint['x']*1.0;
- this.y = nativePoint['y']*1.0;
+
+ this.x = nativePoint['x'] != null? nativePoint['x']*1.0 : null;
+ this.y = nativePoint['y'] != null? nativePoint['y']*1.0 : null;
}
}
@@ -36,13 +37,13 @@ class Point {
class Quadrilateral {
/// upper left point of the quadrilateral
- Point upperLeft;
+ Point? upperLeft;
/// upper right point of the quadrilateral
- Point upperRight;
+ Point? upperRight;
/// lower left point of the quadrilateral
- Point lowerLeft;
+ Point? lowerLeft;
/// lower right point of the quadrilateral
- Point lowerRight;
+ Point? lowerRight;
Quadrilateral(Map nativeQuad) {
this.upperLeft = Point(Map.from(nativeQuad['upperLeft']));
@@ -195,7 +196,7 @@ class CardNumberAnonymizationSettings {
class BlinkCardAnonymizationSettings {
/// Defines the parameters of card number anonymization.
- CardNumberAnonymizationSettings cardNumberAnonymizationSettings = new CardNumberAnonymizationSettings();
+ CardNumberAnonymizationSettings? cardNumberAnonymizationSettings = new CardNumberAnonymizationSettings();
/// Defines the mode of card number prefix anonymization.
BlinkCardAnonymizationMode cardNumberPrefixAnonymizationMode = BlinkCardAnonymizationMode.None;
/// Defines the mode of CVV anonymization.
@@ -220,13 +221,13 @@ class BlinkCardAnonymizationSettings {
class ImageExtensionFactors {
/// image extension factor relative to full image height in UP direction.
- double upFactor = 0.0;
+ double? upFactor = 0.0;
/// image extension factor relative to full image height in RIGHT direction.
- double rightFactor = 0.0;
+ double? rightFactor = 0.0;
/// image extension factor relative to full image height in DOWN direction.
- double downFactor = 0.0;
+ double? downFactor = 0.0;
/// image extension factor relative to full image height in LEFT direction.
- double leftFactor = 0.0;
+ double? leftFactor = 0.0;
ImageExtensionFactors();
diff --git a/BlinkCard/lib/types.g.dart b/BlinkCard/lib/types.g.dart
index b48fa7f..e84cf26 100644
--- a/BlinkCard/lib/types.g.dart
+++ b/BlinkCard/lib/types.g.dart
@@ -9,8 +9,7 @@ part of 'types.dart';
CardNumberAnonymizationSettings _$CardNumberAnonymizationSettingsFromJson(
Map json) {
return CardNumberAnonymizationSettings()
- ..mode =
- _$enumDecodeNullable(_$BlinkCardAnonymizationModeEnumMap, json['mode'])
+ ..mode = _$enumDecode(_$BlinkCardAnonymizationModeEnumMap, json['mode'])
..prefixDigitsVisible = json['prefixDigitsVisible'] as int
..suffixDigitsVisible = json['suffixDigitsVisible'] as int;
}
@@ -23,36 +22,30 @@ Map _$CardNumberAnonymizationSettingsToJson(
'suffixDigitsVisible': instance.suffixDigitsVisible,
};
-T _$enumDecode(
- Map enumValues,
- dynamic source, {
- T unknownValue,
+K _$enumDecode(
+ Map enumValues,
+ Object? source, {
+ K? unknownValue,
}) {
if (source == null) {
- throw ArgumentError('A value must be provided. Supported values: '
- '${enumValues.values.join(', ')}');
+ throw ArgumentError(
+ 'A value must be provided. Supported values: '
+ '${enumValues.values.join(', ')}',
+ );
}
- final value = enumValues.entries
- .singleWhere((e) => e.value == source, orElse: () => null)
- ?.key;
-
- if (value == null && unknownValue == null) {
- throw ArgumentError('`$source` is not one of the supported values: '
- '${enumValues.values.join(', ')}');
- }
- return value ?? unknownValue;
-}
-
-T _$enumDecodeNullable(
- Map enumValues,
- dynamic source, {
- T unknownValue,
-}) {
- if (source == null) {
- return null;
- }
- return _$enumDecode(enumValues, source, unknownValue: unknownValue);
+ return enumValues.entries.singleWhere(
+ (e) => e.value == source,
+ orElse: () {
+ if (unknownValue == null) {
+ throw ArgumentError(
+ '`$source` is not one of the supported values: '
+ '${enumValues.values.join(', ')}',
+ );
+ }
+ return MapEntry(unknownValue, enumValues.values.first);
+ },
+ ).key;
}
const _$BlinkCardAnonymizationModeEnumMap = {
@@ -70,14 +63,14 @@ BlinkCardAnonymizationSettings _$BlinkCardAnonymizationSettingsFromJson(
? null
: CardNumberAnonymizationSettings.fromJson(
json['cardNumberAnonymizationSettings'] as Map)
- ..cardNumberPrefixAnonymizationMode = _$enumDecodeNullable(
+ ..cardNumberPrefixAnonymizationMode = _$enumDecode(
_$BlinkCardAnonymizationModeEnumMap,
json['cardNumberPrefixAnonymizationMode'])
- ..cvvAnonymizationMode = _$enumDecodeNullable(
+ ..cvvAnonymizationMode = _$enumDecode(
_$BlinkCardAnonymizationModeEnumMap, json['cvvAnonymizationMode'])
- ..ibanAnonymizationMode = _$enumDecodeNullable(
+ ..ibanAnonymizationMode = _$enumDecode(
_$BlinkCardAnonymizationModeEnumMap, json['ibanAnonymizationMode'])
- ..ownerAnonymizationMode = _$enumDecodeNullable(
+ ..ownerAnonymizationMode = _$enumDecode(
_$BlinkCardAnonymizationModeEnumMap, json['ownerAnonymizationMode']);
}
@@ -99,10 +92,10 @@ Map _$BlinkCardAnonymizationSettingsToJson(
ImageExtensionFactors _$ImageExtensionFactorsFromJson(
Map json) {
return ImageExtensionFactors()
- ..upFactor = (json['upFactor'] as num)?.toDouble()
- ..rightFactor = (json['rightFactor'] as num)?.toDouble()
- ..downFactor = (json['downFactor'] as num)?.toDouble()
- ..leftFactor = (json['leftFactor'] as num)?.toDouble();
+ ..upFactor = (json['upFactor'] as num?)?.toDouble()
+ ..rightFactor = (json['rightFactor'] as num?)?.toDouble()
+ ..downFactor = (json['downFactor'] as num?)?.toDouble()
+ ..leftFactor = (json['leftFactor'] as num?)?.toDouble();
}
Map _$ImageExtensionFactorsToJson(
diff --git a/BlinkCard/pubspec.yaml b/BlinkCard/pubspec.yaml
index 9588f10..97ba560 100644
--- a/BlinkCard/pubspec.yaml
+++ b/BlinkCard/pubspec.yaml
@@ -1,23 +1,23 @@
name: blinkcard_flutter
description: Flutter plugin for BlinkCard, SDK for scanning and OCR of various credit cards.
-version: 2.3.0
+version: 2.4.0
author: Microblink
homepage: https://microblink.com
environment:
- sdk: ">=2.7.0 <3.0.0"
+ sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.10.0"
dependencies:
flutter:
sdk: flutter
- json_annotation: ^3.0.1
+ json_annotation: ^4.0.0
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.9.0
- json_serializable: ^3.3.0
+ json_serializable: ^4.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
diff --git a/Release notes.md b/Release notes.md
index ffce8cd..a8035a1 100644
--- a/Release notes.md
+++ b/Release notes.md
@@ -1,3 +1,8 @@
+## 2.4.0
+
+- Updated to [Android SDK v2.4.0](https://github.com/BlinkCard/blinkcard-android/releases/tag/v2.4.0) and [iOS SDK v2.4.0](https://github.com/BlinkCard/blinkcard-ios/releases/tag/v2.4.0)
+- Migrated to Null Safety
+
## 2.3.0
Initial plugin release with [Android SDK v2.3.0](https://github.com/BlinkCard/blinkcard-android/releases/tag/v2.3.0) and [iOS SDK v2.3.0](https://github.com/BlinkCard/blinkcard-ios/releases/tag/v2.3.0)
\ No newline at end of file
diff --git a/sample_files/main.dart b/sample_files/main.dart
index 7f5f5a0..e5ad8c4 100644
--- a/sample_files/main.dart
+++ b/sample_files/main.dart
@@ -20,9 +20,11 @@ class _MyAppState extends State {
Future scan() async {
String license;
if (Theme.of(context).platform == TargetPlatform.iOS) {
- license = "sRwAAAEVY29tLm1pY3JvYmxpbmsuc2FtcGxl1BIcP6dpSuS/37rVOeGPMWzs39PRBgwM++WWSOa9w92s2Hn7+UdGcj+24Qru7zu1wxKzfLavdwHIzHlNKddkURwZVIvzE9jPilOKiRc26Bmwum9fehPfOzB0MUCUog2U+itV8GM8VHReXZe4A6COTULp5z3GZ0O9dcaPcuHhtzGZkCjDka9KCJxcLQmvIXbz/jTDVW/xhH4JPM4GIMlhRSePMV7gjWx8jwKrD0TKSQ==";
+ license = "sRwAAAEVY29tLm1pY3JvYmxpbmsuc2FtcGxl1BIcP6dpSuS/37rVPvGgnEXtW6n0WYNXlN/0i1f88yoVpcC6wVI7C9/PwW96iHudfFxZtXdYuU3G3FGWKgCcqkSdZwRtiHrFeYz8beVEwPAGbLMPGidJ8qm5ZtgfLYHJ5NqR0qfIfqKTIDlsGzUY2D2qp3KUfYcscbf9JftuQdMpQ8VfQ8eu0+x1aUckcowsgAfq8/CTF3cpaSF1mBKMCO+idtTRWI8B52aZZDeybQ==";
} else if (Theme.of(context).platform == TargetPlatform.android) {
- license = "sRwAAAAVY29tLm1pY3JvYmxpbmsuc2FtcGxlU9kJdb5ZkGlTu623OTxHZKAmHTzXqVNPuhHHnXm497TWowJa0vswsDtOQZq7Sc8lndoPORaoDMYFMvzd4/aLTADiHm1Tg3+sCO9AS5lKKIrKANkKNEDvlHwYct9+g5e3xyq6fVy+uMzsdkFZqqbpCChDILiBQOJF4NOTufTLEDSeVNNV10nLisEBYEzD4zWZ9vnBZRNvg7WeEHOUoAOkn521e3E/oK9Andekqi0zbg==";
+ license = "sRwAAAAVY29tLm1pY3JvYmxpbmsuc2FtcGxlU9kJdb5ZkGlTu623Pixsw037mGhBUOlKf9FyC46r0aJfr+2FJclONWXQv/Xlj27pDDhp07b66EWvmCZeP9oUM7zUHo17x8A4DC8nIZhxCsRgz5FLeMD7opEa+XVTb3/kxNOc8zNZ2XSG0Pw9VTxYf/74hEC7mVhYMIK+4Nf94HM5hujNJInjb5BRLBqrje6tcOlqgSDdQGBkCIre9FOLJDgVtyq41HIwC4cxSS/ryg==";
+ } else {
+ license = "";
}
var cardRecognizer = BlinkCardRecognizer();
@@ -42,8 +44,8 @@ class _MyAppState extends State {
setState(() {
_resultString = _resultString;
- _fullDocumentFirstImageBase64 = result.firstSideFullDocumentImage;
- _fullDocumentSecondImageBase64 = result.secondSideFullDocumentImage;
+ _fullDocumentFirstImageBase64 = result.firstSideFullDocumentImage ?? "";
+ _fullDocumentSecondImageBase64 = result.secondSideFullDocumentImage ?? "";
});
return;
@@ -61,7 +63,7 @@ class _MyAppState extends State {
buildDateResult(result.expiryDate, 'Expiry date');
}
- String buildResult(String result, String propertyName) {
+ String buildResult(String? result, String propertyName) {
if (result == null || result.isEmpty) {
return "";
}
@@ -69,7 +71,7 @@ class _MyAppState extends State {
return propertyName + ": " + result + "\n";
}
- String buildDateResult(Date result, String propertyName) {
+ String buildDateResult(Date? result, String propertyName) {
if (result == null || result.year == 0) {
return "";
}
@@ -78,8 +80,8 @@ class _MyAppState extends State {
"${result.day}.${result.month}.${result.year}", propertyName);
}
- String buildIntResult(int result, String propertyName) {
- if (result < 0) {
+ String buildIntResult(int? result, String propertyName) {
+ if (result == null || result < 0) {
return "";
}