Meeting.fromMap constructor

Meeting.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory Meeting.fromMap(Map<String, dynamic> map) {
  return Meeting(
    id: map['id'] as int,
    title: map['title'] as String,
    participants: List<Participant>.from(
      (map['participants'] as List).map<Participant>(
        (x) => Participant.fromMap(x as Map<String, dynamic>),
      ),
    ),
    members: List<Member>.from(
      (map['members'] as List).map<Member>(
        (x) => Member.fromMap(x as Map<String, dynamic>),
      ),
    ),
    code: map['code'],
    status: (int.tryParse(map['status'].toString()) ?? 0).getChatStatusEnum,
    createdAt: DateTime.parse(map['createdAt']).toLocal(),
    latestJoinedAt:
        DateTime.parse(map['latestJoinedAt'] ?? map['createdAt']).toLocal(),
    latestMessage: map['latestMessage'] != null &&
            map['latestMessage'] is Map<String, dynamic>
        ? MessageModel.fromMap(map['latestMessage'])
        : null,
  );
}