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); int id; String nickname; String username; String icon; String phone; String sex; int moneyCoin; //余额 double moneyPoint; //积分 int birthday; bool noticeFlag;//是否通知 bool remindFlag;//是否通知 bool createFlag;//创建房间权限 factory UserInfo.fromJson(Map json) => _$UserInfoFromJson(json); Map toJson() => _$UserInfoToJson(this); // 命名构造函数 UserInfo.empty(); @override String toString() { return _$UserInfoToJson(this).toString(); } }