GroupMember.fromMap constructor
GroupMember.fromMap(
- dynamic map
Creates a new GroupMember
instance from a map.
Implementation
factory GroupMember.fromMap(dynamic map) {
if (map == null) {
throw ArgumentError('The type of group member map is null');
}
return GroupMember(
scope: map['scope']?.toString() ?? '',
joinedAt: DateTime.fromMillisecondsSinceEpoch(map['joinedAt'] * 1000),
uid: map['uid'],
name: map['name'],
avatar: map['avatar'],
link: map['link'],
role: map['role'],
status: map['status'],
statusMessage: map['statusMessage'],
lastActiveAt: map['lastActiveAt'] == 0 || map['lastActiveAt'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(map['lastActiveAt'] * 1000),
tags: List<String>.from(map['tags'] ?? []),
hasBlockedMe: map['hasBlockedMe'],
blockedByMe: map['blockedByMe'],
metadata: Map<String, dynamic>.from(json.decode(map['metadata'] ?? '{}')),
);
}