Flutter 使用包资源
2020-07-19 本文已影响0人
喜剧收尾_XWX
- 访问包仓库 https://pub.dev/
- 搜索到你想要的包,以provider为例子
- Depend on it
Add this to your package's pubspec.yaml file:
dependencies:
provider: ^4.3.1
- Install it
You can install packages from the command line:
with Flutter:
$ flutter pub get
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
- Import it
Now in your Dart code, you can use:
import 'package:provider/provider.dart';