I am confused about how to use image_picker, this is how I use it in my application (like in many tutorials):
class AddDialogState extends State<AddDialog> { File galleryFile; Widget _onlyStatus() { getLocalImage() async { var _galleryFile = await ImagePicker.pickImage( source: ImageSource.gallery }; setState(() { galleryFile = _galleryFile; }); print(_galleryFile.path); } return Column( ........ FlatButton.icon( onPressed: () { getLocalImage(); } ) ) } @override Widget build(BuildContext context) { // fullscreen dialog ......... body: _onlyStatus() } } The problem was, the above code doesn't start ImagePicker, when i click the FlatButton, the above code just produce an error the getter 'path' was called on null, it doesn't start any new activity related to gallery, so what's wrong with my code?
