- 打开pubspec.yaml
- 找到dependencies
- 在最下面添加 dio: ^1.0.9
- ctrl + s 之后,会自动下载依赖
使用:
// get请求
import 'package:dio/dio.dart';
Dio dio = new Dio();
var response = await dio.get("/test", data:{"id":12, "name":"marron"})
print(response.data);// post请求
response = await dio.post("/test", data:{"id":12, "name": "marron"})