12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/response/user_profile.dart';
- UserProfile $UserProfileFromJson(Map<String, dynamic> json) {
- final UserProfile userProfile = UserProfile();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- userProfile.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- userProfile.name = name;
- }
- final String? phone = jsonConvert.convert<String>(json['phone']);
- if (phone != null) {
- userProfile.phone = phone;
- }
- final String? avatar = jsonConvert.convert<String>(json['avatar']);
- if (avatar != null) {
- userProfile.avatar = avatar;
- }
- final String? passwordType = jsonConvert.convert<String>(json['password_type']);
- if (passwordType != null) {
- userProfile.passwordType = passwordType;
- }
- final dynamic registrationId = json['registration_id'];
- if (registrationId != null) {
- userProfile.registrationId = registrationId;
- }
- return userProfile;
- }
- Map<String, dynamic> $UserProfileToJson(UserProfile entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['phone'] = entity.phone;
- data['avatar'] = entity.avatar;
- data['password_type'] = entity.passwordType;
- data['registration_id'] = entity.registrationId;
- return data;
- }
- extension UserProfileExtension on UserProfile {
- UserProfile copyWith({
- int? id,
- String? name,
- String? phone,
- String? avatar,
- String? passwordType,
- dynamic registrationId,
- }) {
- return UserProfile()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..phone = phone ?? this.phone
- ..avatar = avatar ?? this.avatar
- ..passwordType = passwordType ?? this.passwordType
- ..registrationId = registrationId ?? this.registrationId;
- }
- }
|