import 'package:json_annotation/json_annotation.dart'; part 'CustomerService.g.dart'; @JsonSerializable() class CustomerService { CustomerService(this.id, this.serviceName, this.icon, this.telephone,this.wchat,this.qq); int id; String serviceName; String icon; String telephone; String wchat; String qq; factory CustomerService.fromJson(Map json) => _$CustomerServiceFromJson(json); Map toJson() => _$CustomerServiceToJson(this); // 命名构造函数 CustomerService.empty(); @override String toString() { return _$CustomerServiceToJson(this).toString(); } }