flutter 导入 http 库 import 'package:http/http.dart' as http;

1,查看最新 http 版本

https://pub.dartlang.org/packages/http#-installing-tab-

1. Depend on it

在项目中找到 pubspec.yaml


dependencies:
  http: ^0.12.0+1(添加这一行)

2. 安装支持库

或者试用命令安装:


$ flutter packages get

3. 导入 http 

import 'package:http/http.dart';
  
posted @ 2019-01-24 17:47  ytymz  阅读(5596)  评论(1编辑  收藏  举报