NotificationResult.fromMap constructor
NotificationResult.fromMap(
- Map<String, dynamic>? json
)
Implementation
NotificationResult.fromMap(Map<String, dynamic>? json) {
if (json != null) {
id = json['_id'] != null ? json['_id'] : json['id'];
token = json['token'];
tokenExpires = json['tokenExpires'] != null &&
json['tokenExpires']['\$date'] != null
? DateTime.fromMillisecondsSinceEpoch(json['tokenExpires']['\$date'])
: DateTime.now();
type = json['type'];
rid = json['rid'];
msg = json['msg'];
ts = json['ts'] != null && json['ts']['\$date'] != null
? DateTime.fromMillisecondsSinceEpoch(json['ts']['\$date'])
: DateTime.now();
user = json['u'] != null ? NotificationUser.fromMap(json['u']) : null;
updatedAt = json['_updatedAt'] != null &&
json['_updatedAt']['\$date'] != null
? DateTime.fromMillisecondsSinceEpoch(json['_updatedAt']['\$date'])
: DateTime.now();
mentions =
json['mentions'] != null ? List<String>.from(json['mentions']) : null;
channels =
json['channels'] != null ? List<String>.from(json['channels']) : null;
}
}