Dart
Type 'String' is not a subtype of type 'int' of 'index'
정후닝
2020. 8. 10. 15:14
보통 모델만들어서 http 통신할때 json 파싱할때 문자열에 인덱스로 접근하려고하거나 할때 생기는 오류임.

var a = jsondecode(res.body).cast<Map<String,dynamic>>();
print(${a[0]['Fiends'][0]['email']}'); => "soon@naver.com" 출력
그런데 a['Friends][0]['email'] => 이런식으로 하면 문자열값으로 인덱스에 엑세스 할수 없을때 발생하는 오류라고 생각하며됨.