赞
踩
配置 image_picker 插件。
- dependencies:
- flutter:
- sdk: flutter
- flutter_localizations:
- sdk: flutter
- date_format: ^1.0.6
- flutter_cupertino_date_picker: ^1.0.26+2
- flutter_swiper: ^1.1.6
- fluttertoast: ^7.1.6
- http: ^0.12.2
- flutter_html: ^1.1.0
- flutter_inappwebview: ^4.0.0+4
- device_info: ^1.0.0
- amap_location: ^0.2.0
-
- # 上传图片
- dio: ^3.0.10
-
- # 拍照上传
- image_picker: ^0.6.7+21
在pubspec.yaml中配置保存后,在VS Code环境中会自动下载依赖包。
如果无法正常下载,执行 flutter pub get 。
在需要用到的该插件的文件中引入插件包。
import 'package:image_picker/image_picker.dart';
- // 图片文件
- File _image;
- // 实例化
- final picker = ImagePicker();
-
- // 获取图片方法
- Future getImage() async {
- f
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。