void _onNextClick() {
debugPrint("Before Next Click: ${_animationController.value}");
if (_animationController.value >= 0 && _animationController.value <= 0.2) {
// RelaxView: 이메일, 비밀번호, 닉네임 저장
signUpData.email = signUpData.email.trim();
signUpData.password = signUpData.password.trim();
signUpData.nickname = signUpData.nickname.trim();
_animationController.animateTo(0.4);
} else if (_animationController.value > 0.2 && _animationController.value <= 0.4) {
// CareView: 성별, 나이 저장
final careViewState = (_getStateOf<CareView>() as _CareViewState?);
if (careViewState != null &&
careViewState.gender != null &&
careViewState.age != null) {
signUpData.gender = careViewState.gender!;
signUpData.age = careViewState.age!;
_animationController.animateTo(0.6);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("성별과 나이를 입력해주세요.")),
);
}
} else if (_animationController.value > 0.4 && _animationController.value <= 0.6) {
_animationController.animateTo(0.8);
} else if (_animationController.value > 0.6 && _animationController.value <= 0.8) {
_signUpClick();
}
debugPrint("After Next Click: ${_animationController.value}");
}
The name '_CareViewState' isn't a type, so it can't be used in an 'as' expression.
Try changing the name to the name of an existing type, or creating a type with the name '_CareViewState'.
이런 오류가 떴다.
_CareViewState가 private 클래스(_로 시작)라서
as _CareViewState 같은 식으로 외부에서 캐스팅할 수 없기 때문에 생기는 오류
이럴땐 public으로 전환해서 사용하면 된다. 앞에 붙어있는 _만 떼고 CareViewState로 쓰면 public이다.
있는 클래스를 가져왔는데 오류가 뜨면 대부분 확장자 문제였던것 같다.