[Flutter] Error: A non-null value must be returned since the return type 'S' doesn't allow null에러

임효진·2024년 3월 26일
0

이슈

목록 보기
3/5

../../.pub-cache/hosted/pub.dev/get-4.6.6/lib/get_instance/src/get_instance.dart:282:5: Error: A non-null value must be returned since the return type 'S' doesn't allow null.

위와 같은 에러가 발생하였다. 나의 경우에는 GetX 4.6.6(2024년 기준 최신) 버전을 사용하고 있었는데, 문제의 원인을 찾기 힘들었다.
다운그레이드를 해보기도 하고, GetX의 return 부분을 모두 검사하고, Xcode빌드 쪽에서도 문제를 찾아보려 했으나 여전히 에러는 해결되지 않았다.
다행스럽게 나와 동일한 이슈를 찾았고 아래와 같은 방법으로 해결하였다.

dart pub cache clean

flutter pub get

참고 : https://github.com/jonataslaw/getx/issues/2826

profile
네트워크 엔지니어에서 풀스택 개발자로

0개의 댓글