vijaycreations
Published in

vijaycreations

Image Picker — Flutter

In this article we will be discussing regarding, how to choose and upload a gallery image in Flutter,

Add up the following dependency in your pubspec.yaml file.

image_picker: ^0.5.3+1

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vijay R

Hai👋 I’m a flutter developer experienced in designing and developing stunning mobile apps. Reach out for freelance projects: vijaycreations02@gmail.com