fromMap static method
Implementation
static PostEntity? fromMap(Object? o, {Map<String, String>? newDocumentIds}) {
if (o == null) return null;
var map = o as Map<String, dynamic>;
var pageParametersFromMap = map['pageParameters'];
if (pageParametersFromMap != null) {
pageParametersFromMap = map['pageParameters'];
}
var memberMediaFromMap = map['memberMedia'];
List<MemberMediumContainerEntity> memberMediaList;
if (memberMediaFromMap != null) {
memberMediaList = (map['memberMedia'] as List<dynamic>)
.map((dynamic item) => MemberMediumContainerEntity.fromMap(
item as Map,
newDocumentIds: newDocumentIds)!)
.toList();
} else {
memberMediaList = [];
}
return PostEntity(
authorId: map['authorId'],
timestamp: map['timestamp'] == null
? null
: (map['timestamp'] as Timestamp).millisecondsSinceEpoch,
appId: map['appId'],
feedId: map['feedId'],
postAppId: map['postAppId'],
postPageId: map['postPageId'],
pageParameters: pageParametersFromMap,
html: map['html'],
description: map['description'],
likes: int.tryParse(map['likes'].toString()),
dislikes: int.tryParse(map['dislikes'].toString()),
accessibleByGroup: map['accessibleByGroup'],
accessibleByMembers: map['accessibleByMembers'] == null
? null
: List.from(map['accessibleByMembers']),
readAccess:
map['readAccess'] == null ? null : List.from(map['readAccess']),
archived: map['archived'],
externalLink: map['externalLink'],
memberMedia: memberMediaList,
);
}