fromJson method

  1. @override
T fromJson(
  1. Object json
)

Implementation

@override
T fromJson(Object json) {
  if (json is Map<String, dynamic>) {
    if (json.containsKey('end_at')) {
      return RestrictedUser.fromJson(json) as T;
    } else if (json.containsKey('muted_end_at') ||
        json.containsKey('is_muted')) {
      return Member.fromJson(json) as T;
    } else {
      return User.fromJson(json) as T;
    }
  }
  return json as T;
}