예전에 플러터로 만들었던 앱을 다시 켜보는데 이미지가 모두 처참하게 깨져있었다..
======== Exception caught by image resource service =========
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 403, https://....
When the exception was thrown, this was the stack:
#0 NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:117:9)
<asynchronous suspension>
Image provider: NetworkImage("https://...", scale: 1.0)
Image key: NetworkImage("https://...", scale: 1.0)
Image.network(url)로 이미지를 불러오고 있었고, 서버에는 문제가 없는 상황
해결방법

header에 User-Agent를 추가하면 되는 것이었다.
그렇다면 User-Agent를 어떻게 찾는가?
- 구글 크롬에서 F12키를 눌러서 개발자 모드로 이동
- 콘솔창에 navigator.userAgent 입력
- user agent 값이 출력되므로 그대로 복사
'프로그래밍 > Flutter' 카테고리의 다른 글
| [Mac] Flutter & Android Studio 설치 관련 이슈 해결 방법 모음 (0) | 2023.02.20 |
|---|