File tree Expand file tree Collapse file tree
packages/image_picker/image_picker Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ## 0.6.7+10
2+
3+ * Updated documentation with code that does not throw an error when image is not picked.
4+
15## 0.6.7+9
26
37* Updated the ExifInterface to the AndroidX version to support more file formats;
Original file line number Diff line number Diff line change @@ -29,8 +29,22 @@ Add `android:requestLegacyExternalStorage="true"` as an attribute to the `<appli
2929### Example
3030
3131``` dart
32+ import 'dart:io';
33+
34+ import 'package:flutter/material.dart';
3235import 'package:image_picker/image_picker.dart';
3336
37+ void main() => runApp(MyApp());
38+
39+ class MyApp extends StatelessWidget {
40+ @override
41+ Widget build(BuildContext context) {
42+ return MaterialApp(
43+ home: MyHomePage(),
44+ );
45+ }
46+ }
47+
3448class MyHomePage extends StatefulWidget {
3549 @override
3650 _MyHomePageState createState() => _MyHomePageState();
@@ -44,7 +58,11 @@ class _MyHomePageState extends State<MyHomePage> {
4458 final pickedFile = await picker.getImage(source: ImageSource.camera);
4559
4660 setState(() {
47- _image = File(pickedFile.path);
61+ if (pickedFile != null) {
62+ _image = File(pickedFile.path);
63+ } else {
64+ print('No image selected.');
65+ }
4866 });
4967 }
5068
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: image_picker
22description : Flutter plugin for selecting images from the Android and iOS image
33 library, and taking new pictures with the camera.
44homepage : https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
5- version : 0.6.7+9
5+ version : 0.6.7+10
66
77flutter :
88 plugin :
You can’t perform that action at this time.
0 commit comments