Participant.fromMap constructor
Construct from a map.
Implementation
factory Participant.fromMap(Map<String, dynamic> map) {
final participant = Participant(
map['sid'],
EnumToString.fromString(Type.values, map['type']) ?? Type.UNSET,
map['conversationSid'],
map['attributes'] != null
? Attributes.fromMap(map['attributes'].cast<String, dynamic>())
: Attributes(AttributesType.NULL, null),
map['dateCreated'],
map['dateUpdated'],
map['identity'],
map['lastReadMessageIndex'],
map['lastReadTimestamp'],
);
if(participant.attributes != null && participant.attributes.data != null) {
Map<String,dynamic> userMap = json.decode(participant.attributes.data!);
participant._userName = userMap['name'];
participant._avatarUrl = userMap['avatar'];
}
return participant;
}