I am looking at this example
@immutable
class UserState {
final bool isLoading;
final LoginResponse user;
UserState({
@required this.isLoading,
@required this.user,
});
factory UserState.initial() {
return new UserState(isLoading: false, user: null);
}
UserState copyWith({bool isLoading, LoginResponse user}) {
return new UserState(
isLoading: isLoading ?? this.isLoading, user: user ?? this.user);
}
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is UserState &&
runtimeType == other.runtimeType &&
isLoading == other.isLoading &&
user == other.user;
@override
int get hashCode => isLoading.hashCode ^ user.hashCode;
}
What does a hashCode have to do with this? What is it used for? (I have shortened the code because I get a stackoverflow error that I am posting mostrly code)
Thank you