我正在看这个例子
@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;
}
hashCode 与此有什么关系?它是干什么用的?(我已经缩短了代码,因为我收到了我发布的大多数代码的 stackoverflow 错误)
谢谢