서버 연결 ã…코드 작성ì중

This commit is contained in:
jieun committed 2026-06-19 15:39:15 +09:00
1 parent f899d52f66
commit 989910a3ff
6 files changed
+1010 -885

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
class ChatMessage {
final String text;
final bool isUser;
final DateTime timestamp;
ChatMessage({
required this.text,
required this.isUser,
required this.timestamp,
});
// JSON에서 ChatMessage로 변환
factory ChatMessage.fromJson(Map<String, dynamic> json) {
return ChatMessage(
text: json['text'] as String,
isUser: json['isUser'] as bool,
timestamp: DateTime.parse(json['timestamp'] as String),
);
}
// ChatMessage를 JSON으로 변환
Map<String, dynamic> toJson() {
return {
'text': text,
'isUser': isUser,
'timestamp': timestamp.toIso8601String(),
};
}
}