performOCR static method

Future<void> performOCR(
  1. String inputPath,
  2. String outputPath
)

Implementation

static Future<void> performOCR(String inputPath, String outputPath) async {
  Process p = await ProcessUtil.start("./data/vision.swift", [inputPath]);
  IOSink out = File(outputPath).openWrite();
  await p.stdout.pipe(out);
  await stderr.addStream(p.stderr);
  int exitCode = await p.exitCode;
  await out.flush();
  await out.close();
  if (exitCode != 0) {
    throw Exception('OCR process failed with exit code $exitCode');
  }
}