2022-02-03 17:06:44 +01:00
|
|
|
class AuthenticationState {
|
|
|
|
final String deviceId;
|
|
|
|
final String userId;
|
|
|
|
final String userEmail;
|
|
|
|
final bool isAuthenticated;
|
2023-11-12 02:03:32 +01:00
|
|
|
final String name;
|
2022-05-29 05:35:45 +02:00
|
|
|
final bool isAdmin;
|
2022-06-27 22:13:07 +02:00
|
|
|
final bool shouldChangePassword;
|
2022-05-29 05:35:45 +02:00
|
|
|
final String profileImagePath;
|
2022-02-03 17:06:44 +01:00
|
|
|
AuthenticationState({
|
|
|
|
required this.deviceId,
|
|
|
|
required this.userId,
|
|
|
|
required this.userEmail,
|
|
|
|
required this.isAuthenticated,
|
2023-11-12 02:03:32 +01:00
|
|
|
required this.name,
|
2022-05-29 05:35:45 +02:00
|
|
|
required this.isAdmin,
|
2022-06-27 22:13:07 +02:00
|
|
|
required this.shouldChangePassword,
|
2022-05-29 05:35:45 +02:00
|
|
|
required this.profileImagePath,
|
2022-02-03 17:06:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
AuthenticationState copyWith({
|
|
|
|
String? deviceId,
|
|
|
|
String? userId,
|
|
|
|
String? userEmail,
|
|
|
|
bool? isAuthenticated,
|
2023-11-12 02:03:32 +01:00
|
|
|
String? name,
|
2022-05-29 05:35:45 +02:00
|
|
|
bool? isAdmin,
|
2022-06-27 22:13:07 +02:00
|
|
|
bool? shouldChangePassword,
|
2022-05-29 05:35:45 +02:00
|
|
|
String? profileImagePath,
|
2022-02-03 17:06:44 +01:00
|
|
|
}) {
|
|
|
|
return AuthenticationState(
|
|
|
|
deviceId: deviceId ?? this.deviceId,
|
|
|
|
userId: userId ?? this.userId,
|
|
|
|
userEmail: userEmail ?? this.userEmail,
|
|
|
|
isAuthenticated: isAuthenticated ?? this.isAuthenticated,
|
2023-11-12 02:03:32 +01:00
|
|
|
name: name ?? this.name,
|
2022-05-29 05:35:45 +02:00
|
|
|
isAdmin: isAdmin ?? this.isAdmin,
|
2022-06-27 22:13:07 +02:00
|
|
|
shouldChangePassword: shouldChangePassword ?? this.shouldChangePassword,
|
2022-05-29 05:35:45 +02:00
|
|
|
profileImagePath: profileImagePath ?? this.profileImagePath,
|
2022-02-03 17:06:44 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-06-27 22:13:07 +02:00
|
|
|
@override
|
|
|
|
String toString() {
|
2023-11-12 02:03:32 +01:00
|
|
|
return 'AuthenticationState(deviceId: $deviceId, userId: $userId, userEmail: $userEmail, isAuthenticated: $isAuthenticated, name: $name, isAdmin: $isAdmin, shouldChangePassword: $shouldChangePassword, profileImagePath: $profileImagePath)';
|
2022-06-27 22:13:07 +02:00
|
|
|
}
|
|
|
|
|
2022-02-03 17:06:44 +01:00
|
|
|
@override
|
|
|
|
bool operator ==(Object other) {
|
|
|
|
if (identical(this, other)) return true;
|
|
|
|
|
|
|
|
return other is AuthenticationState &&
|
|
|
|
other.deviceId == deviceId &&
|
|
|
|
other.userId == userId &&
|
|
|
|
other.userEmail == userEmail &&
|
|
|
|
other.isAuthenticated == isAuthenticated &&
|
2023-11-12 02:03:32 +01:00
|
|
|
other.name == name &&
|
2022-05-29 05:35:45 +02:00
|
|
|
other.isAdmin == isAdmin &&
|
2022-06-27 22:13:07 +02:00
|
|
|
other.shouldChangePassword == shouldChangePassword &&
|
2023-03-23 16:25:58 +01:00
|
|
|
other.profileImagePath == profileImagePath;
|
2022-02-03 17:06:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode {
|
|
|
|
return deviceId.hashCode ^
|
|
|
|
userId.hashCode ^
|
|
|
|
userEmail.hashCode ^
|
|
|
|
isAuthenticated.hashCode ^
|
2023-11-12 02:03:32 +01:00
|
|
|
name.hashCode ^
|
2022-05-29 05:35:45 +02:00
|
|
|
isAdmin.hashCode ^
|
2022-06-27 22:13:07 +02:00
|
|
|
shouldChangePassword.hashCode ^
|
2023-03-23 16:25:58 +01:00
|
|
|
profileImagePath.hashCode;
|
2022-02-03 17:06:44 +01:00
|
|
|
}
|
|
|
|
}
|