feat:增加消息记录功能

This commit is contained in:
2026-06-19 21:10:03 +08:00
parent bb1160ad18
commit 5d12377606
23 changed files with 458 additions and 170 deletions

View File

@@ -0,0 +1,13 @@
import 'package:sweet_chat_app/models/im_message.dart';
class MessageStore {
static final Map<String, List<ImMessage>> _data = {};
static void add(ImMessage msg) {
_data.putIfAbsent(msg.to, () => []).add(msg);
_data.putIfAbsent(msg.from, () => []).add(msg);
}
static List<ImMessage> messagesFor(String userId) =>
_data[userId] ?? [];
}