Presence.fromJson constructor

Presence.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Presence.fromJson(Map<String, dynamic> json) {
  return Presence(
    since: json['since'] != null ? DateTime.parse(json['since']) : null,
    activities: List<Activity>.from(
        json['activities'].map((e) => Activity.fromJson(e))),
    status: StatusType.values
        .firstWhere((element) => element.value == json['status']),
    afk: json['afk'] ?? false,
  );
}