Image Picker — Flutter
In this article we will be discussing regarding, how to choose and upload a gallery image in Flutter,
Video Tutorial
Dependencies
Add up the following dependency in your pubspec.yaml file.
image_picker: ^0.5.3+1
Implementation
To choose a file from local gallery, follow up the below code snippet.
This code will prompt you to the local image gallery, provided the permission to open the media files in your mobile/emulator.
We will be using Future
and async
[Line no: 1], in order to make sure that the compiler waits (pause execution) until we select an image from the gallery.
The maxHeight
and maxWidth
[Line no: 5] parameters can be set as desired based on the individual’s preferences.
Now., to add the selected image as a widget inside the app, Check out the snippet below.
That’s it! We have now added up the image inside Flutter app 🥳
Get the complete Source Code here 👇
👩💻https://github.com/vijayinyoutube/imageupload
✔ Change App Launcher Icon in Flutter
✔ AnimatedContainer Widget in Flutter
If you want to know more about Flutter and various Widgets in Flutter…?🤓 Then visit my channel vijaycreations🚩
Thanks.,