diff --git a/BlinkID/build.yaml b/BlinkID/build.yaml new file mode 100644 index 0000000..7cb5117 --- /dev/null +++ b/BlinkID/build.yaml @@ -0,0 +1,6 @@ +targets: + $default: + builders: + json_serializable: + options: + explicit_to_json: true diff --git a/BlinkID/lib/microblink_scanner.dart b/BlinkID/lib/microblink_scanner.dart index 6746427..4b0c97e 100644 --- a/BlinkID/lib/microblink_scanner.dart +++ b/BlinkID/lib/microblink_scanner.dart @@ -10,7 +10,6 @@ export 'package:blinkid_flutter/overlay_settings.dart'; export 'package:blinkid_flutter/types.dart'; class MicroblinkScanner { - static const MethodChannel _channel = const MethodChannel('blinkid_scanner'); static const String METHOD_SCAN_WITH_CAMERA = 'scanWithCamera'; @@ -22,24 +21,28 @@ class MicroblinkScanner { static const String ARG_LICENSEE = 'licensee'; static const String ARG_SHOW_LICENSE_WARNING = 'showTrialLicenseWarning'; - static Future> scanWithCamera(RecognizerCollection collection, OverlaySettings overlaySettings, String license) async { - var jsonResults = jsonDecode(await _channel.invokeMethod( - METHOD_SCAN_WITH_CAMERA, - { - ARG_RECOGNIZER_COLLECTION: jsonDecode(jsonEncode(collection)), - ARG_OVERLAY_SETTINGS: jsonDecode(jsonEncode(overlaySettings)), - ARG_LICENSE: { - ARG_LICENSE_KEY: license - } - }) + static Future> scanWithCamera( + RecognizerCollection collection, + OverlaySettings overlaySettings, + String license, + ) async { + final jsonResults = jsonDecode( + await _channel.invokeMethod( + METHOD_SCAN_WITH_CAMERA, + { + ARG_RECOGNIZER_COLLECTION: collection.toJson(), + ARG_OVERLAY_SETTINGS: overlaySettings.toJson(), + ARG_LICENSE: {ARG_LICENSE_KEY: license} + }, + ), ); if (jsonResults == null) return List.empty(); - var results = []; + final results = []; for (int i = 0; i < jsonResults.length; ++i) { - var map = Map.from(jsonResults[i]); - var result = collection.recognizerArray[i].createResultFromNative(map); + final map = Map.from(jsonResults[i]); + final result = collection.recognizerArray[i].createResultFromNative(map); if (result.resultState != RecognizerResultState.empty) { results.add(result); } @@ -47,5 +50,4 @@ class MicroblinkScanner { return List.from(results); } - -} \ No newline at end of file +} diff --git a/BlinkID/lib/recognizer.g.dart b/BlinkID/lib/recognizer.g.dart index 6e4d18a..d664826 100644 --- a/BlinkID/lib/recognizer.g.dart +++ b/BlinkID/lib/recognizer.g.dart @@ -74,7 +74,8 @@ RecognizerCollection _$RecognizerCollectionFromJson(Map json) { Map _$RecognizerCollectionToJson( RecognizerCollection instance) => { - 'recognizerArray': instance.recognizerArray, + 'recognizerArray': + instance.recognizerArray.map((e) => e.toJson()).toList(), 'allowMultipleResults': instance.allowMultipleResults, 'milisecondsBeforeTimeout': instance.milisecondsBeforeTimeout, }; diff --git a/BlinkID/lib/recognizers/blink_id_combined_recognizer.g.dart b/BlinkID/lib/recognizers/blink_id_combined_recognizer.g.dart index d184927..b7a283d 100644 --- a/BlinkID/lib/recognizers/blink_id_combined_recognizer.g.dart +++ b/BlinkID/lib/recognizers/blink_id_combined_recognizer.g.dart @@ -47,10 +47,10 @@ Map _$BlinkIdCombinedRecognizerToJson( 'faceImageDpi': instance.faceImageDpi, 'fullDocumentImageDpi': instance.fullDocumentImageDpi, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'maxAllowedMismatchesPerField': instance.maxAllowedMismatchesPerField, 'paddingEdge': instance.paddingEdge, - 'recognitionModeFilter': instance.recognitionModeFilter, + 'recognitionModeFilter': instance.recognitionModeFilter.toJson(), 'returnFaceImage': instance.returnFaceImage, 'returnFullDocumentImage': instance.returnFullDocumentImage, 'returnSignatureImage': instance.returnSignatureImage, diff --git a/BlinkID/lib/recognizers/blink_id_recognizer.g.dart b/BlinkID/lib/recognizers/blink_id_recognizer.g.dart index c4d54a2..3fdd95d 100644 --- a/BlinkID/lib/recognizers/blink_id_recognizer.g.dart +++ b/BlinkID/lib/recognizers/blink_id_recognizer.g.dart @@ -40,9 +40,9 @@ Map _$BlinkIdRecognizerToJson(BlinkIdRecognizer instance) => 'faceImageDpi': instance.faceImageDpi, 'fullDocumentImageDpi': instance.fullDocumentImageDpi, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'paddingEdge': instance.paddingEdge, - 'recognitionModeFilter': instance.recognitionModeFilter, + 'recognitionModeFilter': instance.recognitionModeFilter.toJson(), 'returnFaceImage': instance.returnFaceImage, 'returnFullDocumentImage': instance.returnFullDocumentImage, 'returnSignatureImage': instance.returnSignatureImage, diff --git a/BlinkID/lib/recognizers/document_face_recognizer.g.dart b/BlinkID/lib/recognizers/document_face_recognizer.g.dart index 08a1675..0569bfd 100644 --- a/BlinkID/lib/recognizers/document_face_recognizer.g.dart +++ b/BlinkID/lib/recognizers/document_face_recognizer.g.dart @@ -29,7 +29,7 @@ Map _$DocumentFaceRecognizerToJson( 'faceImageDpi': instance.faceImageDpi, 'fullDocumentImageDpi': instance.fullDocumentImageDpi, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'numStableDetectionsThreshold': instance.numStableDetectionsThreshold, 'returnFaceImage': instance.returnFaceImage, 'returnFullDocumentImage': instance.returnFullDocumentImage, diff --git a/BlinkID/lib/recognizers/mrtd_combined_recognizer.g.dart b/BlinkID/lib/recognizers/mrtd_combined_recognizer.g.dart index 13c070f..8241bb7 100644 --- a/BlinkID/lib/recognizers/mrtd_combined_recognizer.g.dart +++ b/BlinkID/lib/recognizers/mrtd_combined_recognizer.g.dart @@ -36,7 +36,7 @@ Map _$MrtdCombinedRecognizerToJson( 'faceImageDpi': instance.faceImageDpi, 'fullDocumentImageDpi': instance.fullDocumentImageDpi, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'numStableDetectionsThreshold': instance.numStableDetectionsThreshold, 'returnFaceImage': instance.returnFaceImage, 'returnFullDocumentImage': instance.returnFullDocumentImage, diff --git a/BlinkID/lib/recognizers/mrtd_recognizer.g.dart b/BlinkID/lib/recognizers/mrtd_recognizer.g.dart index 10db5ed..80685ac 100644 --- a/BlinkID/lib/recognizers/mrtd_recognizer.g.dart +++ b/BlinkID/lib/recognizers/mrtd_recognizer.g.dart @@ -28,6 +28,6 @@ Map _$MrtdRecognizerToJson(MrtdRecognizer instance) => 'detectGlare': instance.detectGlare, 'fullDocumentImageDpi': instance.fullDocumentImageDpi, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'returnFullDocumentImage': instance.returnFullDocumentImage, }; diff --git a/BlinkID/lib/recognizers/passport_recognizer.g.dart b/BlinkID/lib/recognizers/passport_recognizer.g.dart index 8834837..35ba44d 100644 --- a/BlinkID/lib/recognizers/passport_recognizer.g.dart +++ b/BlinkID/lib/recognizers/passport_recognizer.g.dart @@ -28,7 +28,7 @@ Map _$PassportRecognizerToJson(PassportRecognizer instance) => 'faceImageDpi': instance.faceImageDpi, 'fullDocumentImageDpi': instance.fullDocumentImageDpi, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'returnFaceImage': instance.returnFaceImage, 'returnFullDocumentImage': instance.returnFullDocumentImage, 'signResult': instance.signResult, diff --git a/BlinkID/lib/recognizers/success_frame_grabber_recognizer.g.dart b/BlinkID/lib/recognizers/success_frame_grabber_recognizer.g.dart index 959ca4c..45c2dca 100644 --- a/BlinkID/lib/recognizers/success_frame_grabber_recognizer.g.dart +++ b/BlinkID/lib/recognizers/success_frame_grabber_recognizer.g.dart @@ -17,5 +17,5 @@ Map _$SuccessFrameGrabberRecognizerToJson( SuccessFrameGrabberRecognizer instance) => { 'recognizerType': instance.recognizerType, - 'slaveRecognizer': instance.slaveRecognizer, + 'slaveRecognizer': instance.slaveRecognizer.toJson(), }; diff --git a/BlinkID/lib/recognizers/usdl_combined_recognizer.g.dart b/BlinkID/lib/recognizers/usdl_combined_recognizer.g.dart index f0f7ae2..926c20e 100644 --- a/BlinkID/lib/recognizers/usdl_combined_recognizer.g.dart +++ b/BlinkID/lib/recognizers/usdl_combined_recognizer.g.dart @@ -29,7 +29,7 @@ Map _$UsdlCombinedRecognizerToJson( 'returnFaceImage': instance.returnFaceImage, 'returnFullDocumentImage': instance.returnFullDocumentImage, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'numStableDetectionsThreshold': instance.numStableDetectionsThreshold, 'signResult': instance.signResult, }; diff --git a/BlinkID/lib/recognizers/visa_recognizer.g.dart b/BlinkID/lib/recognizers/visa_recognizer.g.dart index c92ff84..b360fb5 100644 --- a/BlinkID/lib/recognizers/visa_recognizer.g.dart +++ b/BlinkID/lib/recognizers/visa_recognizer.g.dart @@ -25,7 +25,7 @@ Map _$VisaRecognizerToJson(VisaRecognizer instance) => 'faceImageDpi': instance.faceImageDpi, 'fullDocumentImageDpi': instance.fullDocumentImageDpi, 'fullDocumentImageExtensionFactors': - instance.fullDocumentImageExtensionFactors, + instance.fullDocumentImageExtensionFactors.toJson(), 'returnFaceImage': instance.returnFaceImage, 'returnFullDocumentImage': instance.returnFullDocumentImage, };