class UserInfo { int? id; String? name; String? avatar; String? description; String? email; String? googleId; String? appleId; int? status; UserInfo({ this.id, this.name, this.avatar, this.description, this.email, this.googleId, this.appleId, this.status, }); Map toJson() { final map = {}; map["id"] = id; map["name"] = name; map["avatar"] = avatar; map["description"] = description; map["email"] = email; map["google_id"] = googleId; map["apple_id"] = appleId; map["status"] = status; return map; } UserInfo.fromJson(dynamic json) { id = json["id"] ?? 0; name = json["name"] ?? ""; avatar = json["avatar"]; description = json["description"] ?? ""; email = json["email"] ?? ""; googleId = json["google_id"]; appleId = json["apple_id"]; status = json["status"] ?? 0; } /// copyWith 方法 UserInfo copyWith({ int? id, String? name, String? avatar, String? description, String? email, String? googleId, String? appleId, int? status, }) { return UserInfo( id: id ?? this.id, name: name ?? this.name, avatar: avatar ?? this.avatar, description: description ?? this.description, email: email ?? this.email, googleId: googleId ?? this.googleId, appleId: appleId ?? this.appleId, status: status ?? this.status, ); } } class LoginDto { String? accessToken; UserInfo? userInfo; LoginDto({this.accessToken, this.userInfo}); Map toJson() { final map = {}; map["accessToken"] = accessToken; if (userInfo != null) { map["userInfo"] = userInfo?.toJson(); } return map; } LoginDto.fromJson(dynamic json) { accessToken = json["accessToken"] ?? ""; userInfo = json["userInfo"] != null ? UserInfo.fromJson(json["userInfo"]) : null; } }