User.fromMap constructor
User.fromMap(
- dynamic map
Implementation
factory User.fromMap(dynamic map) {
if (map == null) throw ArgumentError('The type of user map is null');
return User(
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'].toInt() * 1000),
tags: map['tags'] == null ? null : List<String>.from(map['tags']),
hasBlockedMe: map['hasBlockedMe'],
blockedByMe: map['blockedByMe'],
metadata: map['metadata'] == null ? null : Map<String, dynamic>.from(json.decode(map['metadata'])),
);
}