import 'package:json_annotation/json_annotation.dart'; part 'UserInfo.g.dart'; @JsonSerializable() class UserInfo { UserInfo(this.id, this.nickname, this.username, this.icon, this.phone, this.sex, this.moneyCoin, this.moneyPoint, this.birthday, this.noticeFlag, this.remindFlag, this.createFlag, this.houseCard, this.recommender, this.levelId, this.moneyTicket, this.channel, this.rank); int id; String nickname; String username; String icon; String phone; String sex; double moneyCoin; //余额 double moneyPoint; //积分 int birthday; bool noticeFlag; //是否通知 bool remindFlag; //是否通知 bool createFlag; //创建房间权限 int houseCard; int recommender; //上级ID int levelId; //用户级别ID int moneyTicket; //门票数量 int channel; //渠道ID int rank; //排名 factory UserInfo.fromJson(Map json) => _$UserInfoFromJson(json); Map toJson() => _$UserInfoToJson(this); // 命名构造函数 UserInfo.empty(); @override String toString() { return _$UserInfoToJson(this).toString(); } }