Authenticated Request1 [Cookbook] Authenticated Request 보내는 방법 [목적] 대부분의 web service에서 authorization을 부여해야 함. HTTP Header에서 Authorization을 주는 방법 알기 [방법] http package에서 header에 추가하는 손쉬운 방법을 제공함 [예시] Future fetchAlbum() async { final response = await http.get( Uri.parse('https://jsonplaceholder.typicode.com/albums/1'), headers: { httpHeaders.authorizationHeader: 'Basic your_api_token_here', }, ); final responseJson = jsonDecode(response.body); return Album.fr.. 2022. 7. 25. 이전 1 다음