readMeta method
The content of the session meta line, or an empty map if absent.
Implementation
Future<Map<String, Object?>> readMeta() async {
if (files.isEmpty) return const {};
final firstLine = await files.first
.openRead()
.transform(utf8.decoder)
.transform(const LineSplitter())
.firstWhere((_) => true, orElse: () => '');
try {
final decoded = jsonDecode(firstLine);
if (decoded is Map<String, Object?>) {
final meta = decoded[FileLogCodec.metaKey];
if (meta is Map<String, Object?>) return meta;
}
} on FormatException {
// Не meta-строка — считаем, что метаданных нет.
}
return const {};
}