user_model.dart 497 B

123456789101112131415161718192021222324
  1. import 'base_model.dart';
  2. class UserModel extends BaseModel {
  3. String name = "";
  4. int id = 0;
  5. String email = "";
  6. int age = 0;
  7. UserModel.fromJson(Map<String, dynamic> json) {
  8. name = json['name'];
  9. id = json['id'];
  10. email = json['email'];
  11. age = json['age'];
  12. }
  13. Map<String, dynamic> toJson() {
  14. final Map<String, dynamic> data = <String, dynamic>{};
  15. data['name'] = name;
  16. data['id'] = id;
  17. data['email'] = email;
  18. data['age'] = age;
  19. return data;
  20. }
  21. }