Files
sweet_chat_app/lib/services/message_store.dart
2026-06-19 21:10:03 +08:00

13 lines
360 B
Dart

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] ?? [];
}