26 lines
609 B
Dart
26 lines
609 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
||
|
||
part 'chat_message.g.dart';
|
||
|
||
@JsonSerializable()
|
||
class ChatMessage {
|
||
final int msgId;
|
||
final int senderId;
|
||
final String content;
|
||
/// 消息类型(1文本 2图片 3语音)
|
||
final int msgType;
|
||
final DateTime createTime;
|
||
|
||
ChatMessage({
|
||
required this.msgId,
|
||
required this.senderId,
|
||
required this.content,
|
||
required this.msgType,
|
||
required this.createTime,
|
||
});
|
||
|
||
factory ChatMessage.fromJson(Map<String, dynamic> json) =>
|
||
_$ChatMessageFromJson(json);
|
||
|
||
Map<String, dynamic> toJson() => _$ChatMessageToJson(this);
|
||
} |