startGenericDocumentRecognizer static method

Future<GenericDocumentResults> startGenericDocumentRecognizer(
  1. GenericDocumentRecognizerConfiguration config
)

Starts the Ready-to-Use Generic Document Recognizer as a full-screen modal UI dialog. The Generic Document Recognizer provides guided, automatic document scanning.

Implementation

static Future<GenericDocumentResults> startGenericDocumentRecognizer(
    GenericDocumentRecognizerConfiguration config) async {
  try {
    var updatedParameters = config.toJson();
    const defaultJsonName = "GenericDocumentScreen";
    var configuration = await SharedCalls.applyParametersOnDefaultJson(
        defaultJsonName, updatedParameters);
    var result = await SharedCalls.invoke(
        _channel, 'startGenericDocumentRecognizer', configuration);
    if (SharedCalls.wasCanceled(result)) {
      return GenericDocumentResults.canceled();
    }
    var genericResult = GenericDocumentResults.fromJson(jsonDecode(result));
    return GenericDocumentResults.fromGenericDocumentResults(genericResult);
  } catch (e) {
    Logger.root.severe(e);
    return GenericDocumentResults.error(e.toString());
  }
}