강의

멘토링

커뮤니티

Inflearn Community Q&A

dhsktmd1233487's profile image
dhsktmd1233487

asked

Flutter Beginner - Http Communication, State Management

The operator '<' can't be unconditionally invoked because the receiver can be 'null'.

Written on

·

1.1K

0

< 연산자를 사용하지 못한다고하는 것 같은데.. 어떻게 해결해야할까요??

androidFlutterios웹앱

Answer 1

1

survivalcoding님의 프로필 이미지
survivalcoding
Instructor

코드를 안 보여주셔서 상상을 해 보겠습니다.

에러 메시지는 < 가 문제는 아니고요. 수행하려면 변수가 null 이러서 그렇습니다. 

예를 들어

a < 10 이런 코드를 수행하려면 a 가 null 이면 안 됩니다. 

null 체크를 추가하시고 ! 로 null 이 아님을 보증하면 될 것 같습니다.

if (a != null && a! < 10) {

}

dhsktmd123님의 프로필 이미지
dhsktmd123
Questioner

감사합니다!!

dhsktmd1233487's profile image
dhsktmd1233487

asked

Ask a question