loadCachedSessionMeta function

Future<SessionMeta?> loadCachedSessionMeta(
  1. String sessionId
)

Load cached session metadata.

Implementation

Future<SessionMeta?> loadCachedSessionMeta(String sessionId) async {
  final metaPath = p.join(getSessionMetaDir(), '$sessionId.json');
  try {
    final file = File(metaPath);
    if (!await file.exists()) return null;
    final content = await file.readAsString();
    return SessionMeta.fromJson(jsonDecode(content) as Map<String, dynamic>);
  } catch (_) {
    return null;
  }
}