Fireship · @fireship
Flutter File Upload - Pick, Crop, and Save Images to the Cloud
Uploaded July 29, 2019 · Length 8:49
Summary
Flutter tutorial on how to capture, crop, and upload images to the cloud using Firebase and Flutter plugins.
- flutter file upload
- firebase storage
- image picker
- image cropper
- flutter plugins
- cloud storage
- flutter tutorial
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
today we'll learn how to do three
- 0:01
distinct things in flutter first we'll
- 0:02
capture an image from the device using
- 0:04
the camera or photo gallery next we'll
- 0:06
allow the user to crop rotate or scale
- 0:08
the image file and lastly we'll upload
- 0:09
the file to a cloud storage bucket and
- 0:11
we'll even throw in a progress bar and a
- 0:13
pause resume button just because it's so
- 0:15
easy to do with flutter and firebase if
- 0:16
you're new here like and subscribe and
- 0:18
follow along with the full write-up on
- 0:19
fire ship I own let's start by taking a
- 0:21
closer look at what we'll build over the
- 0:23
next few minutes you can see down here
- 0:24
in the bottom bar we have two icon
- 0:25
buttons tapping the camera will bring up
- 0:27
the device camera and the image will
- 0:29
bring up the image gallery when the user
- 0:30
selects an image it will give us access
- 0:32
to that file object in our dart code
- 0:34
when the user taps the crop button it
- 0:35
will bring up the image crop or widget
- 0:37
allowing the user to manipulate the
- 0:38
image and that magic is made possible by
- 0:40
the awesome image crop rap legend and
- 0:42
lastly when the user taps the upload to
- 0:44
firebase button it will immediately
- 0:45
start uploading the file to a firebase
- 0:47
storage bucket the progress indicator
- 0:48
will show the percentage of bytes
- 0:50
transferred while the file is uploading
- 0:51
and the user can also control the state
- 0:53
of the upload by pausing or resuming
- 0:55
them so that's a lot of functionality
- 0:56
for a single YouTube video but I think
- 0:58
you might be pleasantly surprised at how
- 0:59
easy this stuff is to implement to get
- 1:01
started you'll need to have a flutter
- 1:02
app with firebase installed I'm not
- 1:04
going to cover the firebase setup
- 1:05
instructions in this video but you can
- 1:07
follow the official instructions or take
- 1:08
the full flutter course as a fire ship
- 1:10
Pro member now if we go ahead and jump
- 1:12
into the pub spec yamo file you can see
- 1:14
we have firebase core and storage these
- 1:16
are the only two firebase dependencies
- 1:17
that you need if your only concern is
- 1:19
uploading files to a cloud storage
- 1:21
bucket but in our case we also want the
- 1:23
user to interact with the native device
- 1:25
camera and image gallery which we can do
- 1:27
with image picker and then image cropper
- 1:29
will allow the user to then manipulate
- 1:31
the image after it's been selected and
- 1:32
these plugins do have a small amount of
- 1:34
platform specific configuration when it
- 1:36
comes to image picker you'll need to go
- 1:38
into your info.plist file for iOS and
- 1:40
add the corresponding permissions for
- 1:42
the photo library and camera and for
- 1:44
image cropper there's no config for iOS
- 1:46
but you do need to add an activity to
- 1:48
your Android manifest file and you
- 1:50
should always refer to the official
- 1:51
documentation when installing a new
- 1:53
plugin in flutter now moving over to our
- 1:55
main dart file we'll go ahead and import
- 1:57
these dependencies and the only other
- 1:59
unusual thing is that we're importing


