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';
  

猜你喜欢

转载自www.cnblogs.com/wf-l5201314/p/10315922.html