readReportFromFile method

Future<void> readReportFromFile(
  1. String path, {
  2. bool sync = false,
  3. bool doClear = true,
})

Implementation

Future<void> readReportFromFile(String path, {bool sync = false, bool doClear = true}) async {
  Log.d(_kTag, 'readReportFromFile start path=$path');

  clearAll();
  final file = sync ? File(path).readAsBytesSync() : await File(path).readAsBytes();
  final reader = CodedBufferReader(file, sizeLimit: 1073741824); // allow for up to 1 Gigabyte

  final reportCollection = ReportCollection.create();
  reportCollection.mergeFromCodedBufferReader(reader);

  Log.d(_kTag, 'readReportFromFile read reportCollection');
  await GetIt.I.get<ReportHandlerService>().handle(reportCollection, offlineFile: true, doClear: doClear);

  Log.d(_kTag, 'readReportFromFile end');
}