getSimpleLogs method

Future<List<SimpleLog>> getSimpleLogs()

Reads all simple logs from persistent storage.

The logs are read from a file named simple_logs.jsonl within the application support directory. The logs are read in JSON Lines format.

The logs are read asynchronously in a separate isolate to avoid blocking the main isolate.

The logs are returned as a list of SimpleLog objects.

Implementation

Future<List<SimpleLog>> getSimpleLogs() async {
  final dir = await getApplicationSupportDirectory();
  final rawLogs =
      await Isolate.run(() => IsolateLogWriter.readLogs(dir.path, 'simple'));
  return rawLogs.map((e) => SimpleLog.fromJson(e)).toList();
}