fromEntityPlus static method
Implementation
static Future<ChatModel?> fromEntityPlus(
String documentID, ChatEntity? entity,
{String? appId}) async {
if (entity == null) return null;
var counter = 0;
return ChatModel(
documentID: documentID,
authorId: entity.authorId ?? '',
appId: entity.appId ?? '',
roomId: entity.roomId,
timestamp: entity.timestamp == null
? null
: DateTime.fromMillisecondsSinceEpoch((entity.timestamp as int)),
saying: entity.saying,
accessibleByGroup: toChatAccessibleByGroup(entity.accessibleByGroup),
accessibleByMembers: entity.accessibleByMembers,
readAccess: entity.readAccess,
chatMedia: entity.chatMedia == null
? null
: List<ChatMediumModel>.from(
await Future.wait(entity.chatMedia!.map((item) {
counter++;
return ChatMediumModel.fromEntityPlus(counter.toString(), item,
appId: appId);
}).toList())),
);
}