http
사용 사례들https://fenderist.tistory.com/129
http
라이브러리 사용Future<String> getData() async {
http.Response response = await http.get(
Uri.encodeFull('http://jsonplaceholder.typicode.com/posts'),
headers: {"Accept": "application/json"},
);
}
https://flutter.dev/docs/cookbook/networking/fetch-data
http
packagehttp.Response
보다 사용자 정의의 object
만들어서 객체반환하게끔 제작 권고json serialization(json 직렬화)
하는 방법은 두가지, 각 상황에 맞게끔 사용 권고factory
문법 처음 봄. (여기선 dart:convert를 안썼네)build()
메소드에 API 호출을 넣지않는게 좋습니다.build()
에 두면 API 불필요한 호출로 앱속도가 느려집니다.fetch()
method in either the initState()
or didChangeDependencies()
methods.https://www.tutorialspoint.com/flutter/flutter_accessing_rest_api.htm
http
packageread − Request the specified url through
GET method and return back the response as Future<String>
get − Request the specified url through GET method and
return back the response as Future<Response>. Response is
a class holding the response information.
post − Request the specified url through POST method
by posting the supplied data and return back the response
as Future<Response>
put − Request the specified url through PUT method
and return back the response as Future<Response>
head − Request the specified url through HEAD method and
return back the response as Future<Response>
delete − Request the specified url through DELETE method and
return back the response as Future<Response>
json serialization(json 직렬화)
하기dart:convert
)
Flutter 공부 중인데 잘 보고가요~~