ChatListModal.fromJson constructor
ChatListModal.fromJson(
- DocumentSnapshot<
Object?> snapshot
Implementation
factory ChatListModal.fromJson(DocumentSnapshot snapshot){
Map json = snapshot.data() as Map;
// var users = json[ApiKeys.users];
// Map otherUserData = {};
// List tempUsers = [];
return ChatListModal(lastMessage: json[ApiKeys.lastMessage],
lastMessageType: json[ApiKeys.lastMessageType],
// unreadCount_other: json['unreadCount_']??0, /// ye bad me karna hai if needed
// unreadCount_my: json['unreadCount_${userData?.userId}']??0,
updatedAt: json[ApiKeys.updatedAt],
createdAt: json[ApiKeys.createdAt]??Timestamp.now(),
users: json[ApiKeys.users],
snapshot: snapshot,
groupChatDetails: json[ApiKeys.groupDetails],
isGroup: json[ApiKeys.isGroup]??false,
involvedUserModals: (json[ApiKeys.zUsersInvolved] as Map<String, dynamic>).map(
(key, value) => MapEntry(key, ChatUserModal.fromJson(value as Map<String, dynamic>)),
),
// otherUsersData: otherUserData,
// otherUsers: tempUsers,
fullData: json,
);
}