Flutter - image_picker使用

##### 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);

你可能感兴趣的