Message.fromMap constructor
Construct from a map.
Implementation
factory Message.fromMap(Map<String, dynamic> map) {
final message = Message(
map['sid'],
map['author'],
DateTime.parse(map['dateCreated']),
DateTime.parse(map['dateUpdated']),
map['lastUpdatedBy'],
map['conversationSid'],
map['subject'],
map['messageBody'],
map['participantSid'],
map['participant'] != null ? Participant.fromMap(map['participant'].cast<String, dynamic>()) : null,
map['messageIndex'],
EnumToString.fromString(MessageType.values, map['type']) ??
MessageType.TEXT,
map['hasMedia'],
map['media'] != null
? MessageMedia.fromMap(map['media'].cast<String, dynamic>())
: null,
map['attributes'] != null
? Attributes.fromMap(map['attributes'].cast<String, dynamic>())
: Attributes(AttributesType.NULL, null),
);
return message;
}