This commit is contained in:
Felipe
2024-02-16 08:52:37 -05:00
parent 1c20d0c0cd
commit 9ca2b62be3
39 changed files with 2299 additions and 327 deletions
@@ -0,0 +1 @@
export 'my_user.dart';
@@ -0,0 +1,70 @@
import 'package:equatable/equatable.dart';
import '../entities/entities.dart';
class MyUser extends Equatable {
final String id;
final String email;
final String name;
String? picture;
MyUser({
required this.id,
required this.email,
required this.name,
this.picture,
});
/// Empty user which represents an unauthenticated user.
static final empty = MyUser(id: '', email: '', name: '', picture: '');
/// Modify MyUser parameters
MyUser copyWith({
String? id,
String? email,
String? name,
String? picture,
}) {
return MyUser(
id: id ?? this.id,
email: email ?? this.email,
name: name ?? this.name,
picture: picture ?? this.picture,
);
}
/// Convenience getter to determine whether the current user is empty.
bool get isEmpty => this == MyUser.empty;
/// Convenience getter to determine whether the current user is not empty.
bool get isNotEmpty => this != MyUser.empty;
MyUserEntity toEntity() {
return MyUserEntity(
id: id,
email: email,
name: name,
picture: picture,
);
}
static MyUser fromEntity(MyUserEntity entity) {
return MyUser(
id: entity.id,
email: entity.email,
name: entity.name,
picture: entity.picture,
);
}
@override
List<Object?> get props => [id, email, name, picture];
}
// final String name;
// final String city;
// final String? profession;
// final String? state;
// final Reference? photo;
// final int? tarifa;
// final String? phoneNumber;
// final String? token;