var uriResponse = await http.get(
Uri.parse(
'http://~~~',
),
);
var json = jsonDecode(uriResponse.body);
return json;
final response= await http.get(Uri.https('www.google.com', '/get/'));
final url=Uri.parse('https://dapi.kakao.com/v3/search/book?target=title&query=doit;
var response=await http.get(url,
headers: {"Authorization":"KakaoAK ##비밀"});
//User 클래스
class User {
final String name;
final String email;
User(this.name, this.email);
User.fromJson(Map<String, dynamic> json)
: name = json['name'],
email = json['email'];
Map<String, dynamic> toJson() =>
{
'name': name,
'email': email,
};
}
//decoding과 데이터 사용
Map userMap = jsonDecode(jsonString);
var user = User.fromJson(userMap);
print('Howdy, ${user.name}!');
print('We sent the verification link to ${user.email}.');
//encoding
String json = jsonEncode(user);
참고자료