cleanupExpiredConversations method
Manually cleans up expired conversations.
Implementation
Future<void> cleanupExpiredConversations() async {
final expiredKeys = <String>[];
final allKeys = await storage.getAllKeys();
for (final key in allKeys) {
final state = await storage.get(key);
if (state != null && _isConversationExpired(state)) {
expiredKeys.add(key);
}
}
for (final key in expiredKeys) {
final state = await storage.get(key);
if (state != null) {
await _cleanupConversation(key, state.conversationName);
}
}
}