Flutter - image_picker使用

2020-02-24  本文已影响0人  西半球_
demo 地址: https://github.com/iotjin/jh_flutter_demo

Flutter从相册选择图片和相机拍照(image_picker)

image_picker Github地址

image_picker packages地址

1、添加到pubspec.yaml

image_picker: ^0.6.3+1 

2、导入

import 'package:image_picker/image_picker.dart';

3、使用

//拍照
 var image = await ImagePicker.pickImage(source: ImageSource.camera);
//相册
 var image = await ImagePicker.pickImage(source: ImageSource.gallery);
上一篇下一篇

猜你喜欢

热点阅读