recent method

  1. @override
Future<List<AuditEntry>> recent({
  1. int limit = 100,
})
override

Returns the most recent entries, newest first, up to limit.

Implementation

@override
Future<List<AuditEntry>> recent({int limit = 100}) async {
  if (!_file.existsSync()) return const [];
  final lines = _file.readAsLinesSync().where((l) => l.trim().isNotEmpty);
  return lines
      .map((l) => AuditEntry.fromJson(jsonDecode(l) as Map<String, dynamic>))
      .toList()
      .reversed
      .take(limit)
      .toList();
}