User.fromJson constructor

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

Implementation

factory User.fromJson(Map<String, dynamic> json) {
  if (json['guest_id'] != null) json['user_id'] = json['guest_id'];
  if (json['is_online'] != null) {
    bool isOnline = json['is_online'];
    json['connection_status'] = isOnline ? 'online' : 'offline';
  }
  return _$UserFromJson(json)
    ..set(SendbirdChat().chat); // Set the singleton chat
}