init method

Future<int> init(
  1. String key
)

Returns 0 if successful.

Implementation

Future<int> init(String key) async {
  try {
    await handleThenable(LicenseManager.initLicense(key, true));
    await handleThenable(CoreModule.loadWasm(["DLR"]));
    _parser = await handleThenable(CodeParser.createInstance());

    await handleThenable(CodeParserModule.loadSpec("VIN"));
    await handleThenable(LabelRecognizerModule.loadRecognitionData("VIN"));

    await handleThenable(CodeParserModule.loadSpec("MRTD_TD1_ID"));
    await handleThenable(CodeParserModule.loadSpec("MRTD_TD2_FRENCH_ID"));
    await handleThenable(CodeParserModule.loadSpec("MRTD_TD2_ID"));
    await handleThenable(CodeParserModule.loadSpec("MRTD_TD2_VISA"));
    await handleThenable(CodeParserModule.loadSpec("MRTD_TD3_PASSPORT"));
    await handleThenable(CodeParserModule.loadSpec("MRTD_TD3_VISA"));
    await handleThenable(LabelRecognizerModule.loadRecognitionData("MRZ"));

    _cvr = await handleThenable(CaptureVisionRouter.createInstance());

    await handleThenable(_cvr!.initSettings(template));
  } catch (e) {
    print(e);
    return -1;
  }

  return 0;
}