copywith y nickname

This commit is contained in:
Felipe
2024-02-22 11:56:41 -05:00
parent 113937df56
commit 37b6665002
8 changed files with 46 additions and 17 deletions
@@ -5,30 +5,45 @@ import '../entities/entities.dart';
class MyUser extends Equatable {
final String id;
final String? email;
final String? phone;
final String? name;
final String? nickname;
final String? picture;
MyUser({
const MyUser({
required this.id,
this.email,
this.phone,
this.name,
this.nickname,
this.picture,
});
/// Empty user which represents an unauthenticated user.
static final empty = MyUser(id: '', email: '', name: '', picture: '');
static const empty = MyUser(
id: '',
email: '',
phone: '',
name: '',
nickname: '',
picture: '',
);
/// Modify MyUser parameters
MyUser copyWith({
String? id,
String? email,
String? phone,
String? name,
String? nickname,
String? picture,
}) {
return MyUser(
id: id ?? this.id,
email: email ?? this.email,
phone: phone ?? this.phone,
name: name ?? this.name,
nickname: nickname ?? this.nickname,
picture: picture ?? this.picture,
);
}
@@ -43,7 +58,9 @@ class MyUser extends Equatable {
return MyUserEntity(
id: id,
email: email,
phone: phone,
name: name,
nickname: nickname,
picture: picture,
);
}
@@ -52,11 +69,13 @@ class MyUser extends Equatable {
return MyUser(
id: entity.id,
email: entity.email,
phone: entity.phone,
name: entity.name,
nickname: entity.nickname,
picture: entity.picture,
);
}
@override
List<Object?> get props => [id, email, name, picture];
List<Object?> get props => [id, email, phone, name, nickname, picture];
}