Untitled
unknown
dart
3 years ago
1.3 kB
1
Indexable
Never
class ConversationsModel { static List<ConversationInfoModel> conversations = []; } class ConversationInfoModel { String conversationID; List<Participants> participants; ConversationInfoModel({this.conversationID, this.participants}); ConversationInfoModel.fromJson(Map<String, dynamic> json) { conversationID = json['conversationID']; if (json['participants'] != null) { participants = new List<Participants>(); json['participants'].forEach((v) { participants.add(new Participants.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['conversationID'] = this.conversationID; if (this.participants != null) { data['participants'] = this.participants.map((v) => v.toJson()).toList(); } return data; } } class Participants { String userID; String fullName; Participants({this.userID, this.fullName}); Participants.fromJson(Map<String, dynamic> json) { userID = json['UserID']; fullName = json['FullName']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['UserID'] = this.userID; data['FullName'] = this.fullName; return data; } }