CachedPresence.fromJson constructor

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

Implementation

factory CachedPresence.fromJson(Map<String, Object?> json) =>
    CachedPresence._(
      presence: PresenceType.values
          .singleWhere((type) => type.name == json['presence']),
      lastActiveTimestamp: json['last_active_timestamp'] != null
          ? DateTime.fromMillisecondsSinceEpoch(
              json['last_active_timestamp'] as int)
          : null,
      statusMsg: json['status_msg'] as String?,
      currentlyActive: json['currently_active'] as bool?,
      userid: json['user_id'] as String,
    );