Image Picker — Flutter

Vijay R
vijaycreations
Published in
2 min readAug 5, 2020

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

--

--

Vijay R
vijaycreations

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