loadMessagesFromCache static method
Load messages from cache
Implementation
static Future<List<Message>> loadMessagesFromCache() async {
try {
final file = await _getCacheFile();
if (!await file.exists()) return [];
final jsonString = await file.readAsString();
final List decoded = jsonDecode(jsonString);
return decoded.map((e) => Message.create()..mergeFromJsonMap(e)).toList();
} catch (e) {
if (kDebugMode) {
print("⚠️ Failed to load cached messages: $e");
}
return [];
}
}