boursorama / ocr_scan_text

OCR Flutter
MIT License
8 stars 6 forks source link

The example code is not working #31

Open alexyuyl opened 4 months ago

alexyuyl commented 4 months ago

I tried

  1. Creating a new flutter project and referencing the library
  2. Downloading the zip and running the example/main.dart
  3. Forking the project and running the example/main.dart

Firstly I am greeted by error about the app is not wrapped inside MaterialApp. I fixed this by wrapping the MyApp inside MaterialApp().

However after the build compiled, none of the three approached worked. It appears the code is only showing a camera preview and the ocr is not working. Tested on both Android and iOS.

Please inform if the example code is the minimum functional code, or I have to add some missing parts myself.

GuillianDrouin commented 4 months ago

Yes, it is now mandatory to have a MaterialApp. The module is not started in the example, sorry for that. You can modify in the example by:

   Widget _buildLiveScan() {
     return LiveScanWidget(
       ocrTextResult: (ocrTextResult) {
         ocrTextResult.mapResult.forEach((module, result) {});
       },
       scanModules: [ScanAllModule()..start()],
     );
   }

I will make a correction to the example, thank you !