codable.dart 269 B

12345678910
  1. abstract class Codable {
  2. /// 将对象转换为JSON格式
  3. Map<String, dynamic> toJson();
  4. /// 从JSON格式创建对象
  5. factory Codable.fromJson(Map<String, dynamic> json) {
  6. throw UnimplementedError('子类必须实现fromJson工厂构造函数');
  7. }
  8. }