import 'package:json_annotation/json_annotation.dart'; part 'ChannelInfo.g.dart'; @JsonSerializable() class ChannelInfo { ChannelInfo(this.id, this.name, this.versionNo, this.ratio,this.ratio2); int id; String name;//名称 String versionNo;//版本号 int ratio;//一级 int ratio2;//二级 factory ChannelInfo.fromJson(Map json) => _$ChannelInfoFromJson(json); Map toJson() => _$ChannelInfoToJson(this); // 命名构造函数 ChannelInfo.empty(); @override String toString() { return _$ChannelInfoToJson(this).toString(); } }