Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 분할정복
- Algorithm
- cos pro
- DFS
- cos
- Vue
- 동적계획법과최단거리역추적
- AndroidStudio
- codingtest
- Flutter
- DFS와BFS
- android
- BAEKJOON
- 코딩테스트
- cos pro 1급
- 코테
- vuejs
- 알고리즘
- DART
- 안드로이드스튜디오
- django
- 코드품앗이
- C++
- issue
- 개발
- 안드로이드
- 동적계획법
- 백준
- Python
- 파이썬
Archives
- Today
- Total
Development Artist
[Flutter, Issue] Error: Method 'validate' cannot be called on 'FormState?' because it is potentially null. Error: Method 'save' cannot be called on 'FormState?' because it is potentially null. 본문
TroubleShooting/Flutter Issue
[Flutter, Issue] Error: Method 'validate' cannot be called on 'FormState?' because it is potentially null. Error: Method 'save' cannot be called on 'FormState?' because it is potentially null.
JMcunst 2022. 1. 6. 15:08728x90
반응형
이슈
Flutter 로그인 페이지를 만드는 중 validateAndSave 함수에서 조건문 안의 form.validate()와 내부의 form.save()에서 다음과 같은 이슈 발생.
해결
1. form뒤에 !를 붙여줌으로써 해결. !는 form이 non-nullable 타입임을 말해준다.
2. form.save() 도 form!.save()로 사용할 수 있다.
원인
1. Flutter 2.0 이후로 null-safety 가 적용되었기 때문이다. 이슈의 원인은 2.0 이전의 코드를 그대로 차용하면서 생긴 문제였다. 'flutter null-safety'로 구글링 해보면 자세한 사항을 확인 할 수 있다.
728x90
반응형
'TroubleShooting > Flutter Issue' 카테고리의 다른 글
Comments