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…