scanWithDirectApi static method
Future<List<RecognizerResult> >
scanWithDirectApi(
- RecognizerCollection collection,
- String frontImage,
- String? backImage,
- String license,
Implementation
static Future<List<RecognizerResult>> scanWithDirectApi(RecognizerCollection collection, String frontImage, String? backImage, String license) async {
var jsonResults = jsonDecode(await _channel.invokeMethod(
METHOD_SCAN_WITH_DIRECT_API,
{
ARG_RECOGNIZER_COLLECTION: jsonDecode(jsonEncode(collection)),
ARG_FRONT_IMAGE: frontImage,
ARG_BACK_IMAGE: backImage,
ARG_LICENSE: {
ARG_LICENSE_KEY: license
}
})
);
if (jsonResults == null) return List.empty();
var results = [];
for (int i = 0; i < jsonResults.length; ++i) {
var map = Map<String, dynamic>.from(jsonResults[i]);
var result = collection.recognizerArray[i].createResultFromNative(map);
if (result.resultState != RecognizerResultState.empty) {
results.add(result);
}
}
return List<RecognizerResult>.from(results);
}