1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import 'package:flutter_provider_demo/model/base_model.dart';
- /// Description:
- /// Time : 09/03/2023 Sunday
- /// Author : liuyuqi.gov@msn.cn
- class UserModel extends BaseModel {
- String name = "";
- int age = 18;
- String email = "";
- String password = "";
- String phone = "";
- String address = "";
- String avator = "";
- String token = "";
- String createdAt = "";
- UserModel({
- required this.name,
- required this.age,
- required this.email,
- required this.password,
- required this.phone,
- required this.address,
- required this.avator,
- required this.token,
- required this.createdAt,
- });
- UserModel.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- name = json['name'];
- age = json['age'];
- email = json['email'];
- password = json['password'];
- phone = json['phone'];
- address = json['address'];
- avator = json['avator'];
- token = json['token'];
- createdAt = json['createdAt'];
- }
- Map<String, dynamic> toJson() {
- return {
- 'id': id,
- 'name': name,
- 'age': age,
- 'email': email,
- 'password': password,
- 'phone': phone,
- 'address': address,
- 'avator': avator,
- 'token': token,
- 'createdAt': createdAt,
- };
- }
- }
- 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']);
- }
- }
- }
|