Activity.fromJson constructor
Activity.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Activity.fromJson(Map<String, dynamic> json) {
return Activity(
name: json['name'],
type: ActivityType.values.firstWhere(
(element) => element.value == json['type'],
orElse: () => ActivityType.unknown),
url: json['url'],
createdAt: DateTime.fromMillisecondsSinceEpoch(json['created_at']),
details: json['details'],
state: json['state'],
emoji: Helper.createOrNull(
field: json['emoji'],
fn: () => ActivityEmoji(
name: json['name'],
id: json['id'],
animated: json['animated'] ?? false)));
}