SeedData.fromMap constructor

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

Implementation

factory SeedData.fromMap(Map<String, dynamic> map) {
  return SeedData(
    member: map['member'] as String?,
    host: map['host'] as String?,
    eventType: map['eventType'] != null
        ? EventType.values.firstWhere(
            (e) => e.toString().split('.').last == map['eventType'])
        : null,
    participants: map['participants'] != null
        ? List<Participant>.from(
            (map['participants'] as List).map((x) => Participant.fromMap(x)))
        : null,
    messages: map['messages'] != null
        ? List<Message>.from(
            (map['messages'] as List).map((x) => Message.fromMap(x)))
        : null,
    polls: map['polls'] != null
        ? List<Poll>.from((map['polls'] as List).map((x) => Poll.fromMap(x)))
        : null,
    breakoutRooms: map['breakoutRooms'] != null
        ? List<List<BreakoutParticipant>>.from((map['breakoutRooms'] as List)
            .map((x) => List<BreakoutParticipant>.from(
                (x as List).map((y) => BreakoutParticipant.fromMap(y)))))
        : null,
    requests: map['requests'] != null
        ? List<Request>.from(
            (map['requests'] as List).map((x) => Request.fromMap(x)))
        : null,
    waitingList: map['waitingList'] != null
        ? List<WaitingRoomParticipant>.from((map['waitingList'] as List)
            .map((x) => WaitingRoomParticipant.fromMap(x)))
        : null,
    whiteboardUsers: map['whiteboardUsers'] != null
        ? List<WhiteboardUser>.from((map['whiteboardUsers'] as List)
            .map((x) => WhiteboardUser.fromMap(x)))
        : null,
  );
}