1. Flutter
  2. Error Reporting

Flutter

Error Reporting

You can report problems encountered during on-device OCR extraction using built-in reporting functions. Any error occurring internally is sent automatically if the device has an internet connection. If not, the SDK will save the error and post it once connectivity is restored. But you can also report issues of predictions to us. Let's dive into how can you report an issue.

๐Ÿงพ Reporting an Issue Manually

Reporting an issue is basically just an API call. So, to report an issue manually from the on-device OCR process, you'll need the ApiManager object here again, like our other cloud-based services:

        class MyOnDeviceOCRManager {

  final OnDeviceOCRManagerCommunicator onDeviceOCRManagerCommunicator;

  MyOnDeviceOCRManager(OnDeviceOCRManagerListener listener):onDeviceOCRManagerCommunicator = OnDeviceOCRManagerCommunicator(listener);

  void reportAnIssue(
    {String? apiKey,
    String? token,
    required ModelToReport modelToReport,
    required String report,
    required Map<String, dynamic>? customData,
    String? base64ImageToReportOn}) {
    onDeviceOCRManagerCommunicator.reportAnIssue(
      apiKey: apiKey,
      token: token,
      modelToReport: modelToReport,
      report: report,
      customData: customData,
      base64ImageToReportOn: base64ImageToReportOn
    );
  }
}

class OnDevceListener implements OnDeviceOCRManagerListener {
  @override void onReportResult(Map<ReportResult, String> reportResult) {}
}

      

๐Ÿ” Parameter Breakdown

Parameter Description
context Android context is needed for getting device information.
apiKey (Optional) API key for authenticating the request.
token (Optional) Bearer token for authenticated sessions (used as an alternative to apiKey).
modelToReport A custom object to provide structured metadata about the report
report A clear description of the issue you're facing. Must not exceed 1000 characters.
customData The response object (if any) received from the on-device scan. Or any other form of data that you might deem important.
base64ImageToReportOn (Optional) Base64 of the image whose results were needed to be reported.

๐Ÿ“ Retrieving SDK Logs

To assist with debugging or support, you can also retrieve the internal SDK logs using:

        class MyOnDeviceOCRManager {

  final OnDeviceOCRManagerCommunicator onDeviceOCRManagerCommunicator;

  MyOnDeviceOCRManager(OnDeviceOCRManagerListener listener):onDeviceOCRManagerCommunicator = OnDeviceOCRManagerCommunicator(listener);

  void exportLogFile() {
    onDeviceOCRManagerCommunicator.exportLogFile();
  }
}

class OnDevceListener implements OnDeviceOCRManagerListener {
  @override void onLogFileExported(String logFilePath) {}
}

      

This method returns a String path, pointing to a ZIP file that contains SDK usage logs. These logs do not include any user-related or sensitive information and are intended for error tracking purposes only.

You can upload this ZIP file to your bug report system or share it with the PackageX support team for deeper investigation.