发送HTTP Post请求

1660次阅读  |  发布于5年以前

发送HTTP Post请求

Use the http package post() function to make a POST request.

import 'package:http/http.dart' as http;

main() async {
  var url = 'http://httpbin.org/post';
  var response = await http.post(url, body: 'name=doodle&color=blue');
  print("Response status: ${response.statusCode}");
  print("Response body: ${response.body}");
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8