class User { final int id; final String phoneNumber; final String fullName; final String? username; final String? photo; final String? email; const User({ required this.id, required this.username, required this.phoneNumber, required this.photo, required this.fullName, required this.email, }); factory User.fromJson(Map json) => User( id: json['id'], username: json['username'], phoneNumber: json['phoneNumber'], photo: json['photo'], fullName: json['fullName'], email: json['email'], ); Map toJson() => { 'id': id, 'username': username, 'phoneNumber': phoneNumber, 'photo': photo, 'fullName': fullName, 'email': email, }; User copyWith({ int? id, String? username, String? phoneNumber, String? photo, String? fullName, String? email, }) { return User( id: id ?? this.id, username: username ?? this.username, phoneNumber: phoneNumber ?? this.phoneNumber, photo: photo ?? this.photo, fullName: fullName ?? this.fullName, email: email ?? this.email, ); } }