我有一个冻结的课程,不知何故我无法访问 copyWith 方法。我的错误是什么?
班级:
@freezed
class LoginState with _$LoginState {
const factory LoginState({
String? username,
String? password,
@Default(false) bool isValid,
String? errorMessage,
}) = _LoginState;
factory LoginState.empty() => LoginState();
factory LoginState.initial() = _Initial;
}
尝试像这样访问copyWith:
LoginState state = LoginState();
state.copyWith(); //cannot access copyWith