강의

멘토링

커뮤니티

Inflearn Community Q&A

gabozanet1044's profile image
gabozanet1044

asked

Flutter Application - Creating an App Using Public APIs (MVVM Pattern)

Convert json data to List<Store>

오류가 납니다.

Written on

·

347

0

 
print(jsonResult['count'])

위 부분에서 아래와 같이 에러가 발생합니다. 어떻게 수정해야 하나요?

Error: A value of type 'String' can't be assigned to a variable of type 'int'.

Flutter

Answer 2

0

survivalcoding님의 프로필 이미지
survivalcoding
Instructor

결과는 가짜 데이터로 항상 동일하기 때문에 코드에서 뭔가 실수가 있지 않았을까 의심이 됩니다.

코드와 비교 한 번 해 보시지요.

https://github.com/junsuk5/flutter_mask

0

survivalcoding님의 프로필 이미지
survivalcoding
Instructor

에러 위치가 위 부분이 아닌 듯 한데요?

일단 에러 메시지 내용은 String 값을 int 변수에 대입하려고 해서 타입이 맞지 않아 발생하는 에러입니다

타입을 통일시키면 에러가 해결됩니다.

구글에서 dart string to int 등의 키워드로 검색하면 방법이 많이 나올 겁니다.

gabozanet1044's profile image
gabozanet1044

asked

Ask a question