Eliminar creche_app/lib/models/message.dart
This commit is contained in:
parent
31f4f4aba0
commit
af4e19c7f4
|
|
@ -1,37 +0,0 @@
|
||||||
class Message {
|
|
||||||
final String id;
|
|
||||||
final String fromUser;
|
|
||||||
final String toUser;
|
|
||||||
final String content;
|
|
||||||
final bool isRead;
|
|
||||||
final DateTime createdAt;
|
|
||||||
|
|
||||||
Message({
|
|
||||||
required this.id,
|
|
||||||
required this.fromUser,
|
|
||||||
required this.toUser,
|
|
||||||
required this.content,
|
|
||||||
required this.isRead,
|
|
||||||
required this.createdAt,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Message.fromMap(Map<String, dynamic> map) {
|
|
||||||
return Message(
|
|
||||||
id: map['id'] ?? '',
|
|
||||||
fromUser: map['from_user'] ?? '',
|
|
||||||
toUser: map['to_user'] ?? '',
|
|
||||||
content: map['content'] ?? '',
|
|
||||||
isRead: map['is_read'] ?? false,
|
|
||||||
createdAt: DateTime.tryParse(map['created_at'] ?? '') ?? DateTime.now(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return {
|
|
||||||
'from_user': fromUser,
|
|
||||||
'to_user': toUser,
|
|
||||||
'content': content,
|
|
||||||
'is_read': isRead,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue