|
@@ -1,8 +1,9 @@
|
|
|
+import 'package:flutter_provider_demo/model/base_model.dart';
|
|
|
+
|
|
|
/// Description:
|
|
|
/// Time : 09/03/2023 Sunday
|
|
|
/// Author : liuyuqi.gov@msn.cn
|
|
|
-class UserModel {
|
|
|
- int id = 0;
|
|
|
+class UserModel extends BaseModel {
|
|
|
String name = "";
|
|
|
int age = 18;
|
|
|
String email = "";
|
|
@@ -14,7 +15,6 @@ class UserModel {
|
|
|
String createdAt = "";
|
|
|
|
|
|
UserModel({
|
|
|
- required this.id,
|
|
|
required this.name,
|
|
|
required this.age,
|
|
|
required this.email,
|
|
@@ -54,3 +54,18 @@ class UserModel {
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+class UserEntity extends BaseEntity {
|
|
|
+ UserEntity({required int code, required String msg, UserModel? data})
|
|
|
+ : super(code: code, msg: msg, data: data);
|
|
|
+
|
|
|
+ UserEntity.fromJson(Map<String, dynamic> json)
|
|
|
+ : super(
|
|
|
+ code: int.parse(json["code"]),
|
|
|
+ msg: json["msg"],
|
|
|
+ ) {
|
|
|
+ if (json['data'] != null) {
|
|
|
+ data = UserModel.fromJson(json['data']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|