PresenceContent.fromJson constructor

PresenceContent.fromJson(
  1. Map<String, Object?> json
)

Implementation

PresenceContent.fromJson(Map<String, Object?> json)
    : presence = PresenceType.values.firstWhere(
        (p) => p.toString().split('.').last == json['presence'],
        orElse: () => PresenceType.offline,
      ),
      lastActiveAgo = json.tryGet<int>('last_active_ago'),
      statusMsg = json.tryGet<String>('status_msg'),
      currentlyActive = json.tryGet<bool>('currently_active');