Download Any file from url in Flutter | Flutter Tutorials 2023

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] foreign so in today's video we are going to see how you can download any file from the URL in flutter so let's start with our video so as you can see here we have a little UI where we have the text and a text form field here where we will input our URL and a download button so what you can do is first of all you need to go to pub.dev and search for flutter file downloader and in the installing install these dependencies in your system okay so once installed what we can do is let's go and in the on price of our button will simply write let's say we will write file downloader dot download file so now as you can see here it is asking for a URL and with the URL we are also getting a name a function for to show our progress on download completed and on download error so what we can do is we will input our URL which is the URL of our controller so which is our URL Dot text Dot frame okay so here we are having our URL and for the progress we're having the progress which asks for the string and a double let's say we'll have a name and our progress so for the progress what we can do is simply go ahead and declare a double which will be our progress foreign and what we can do is we can use set state and we'll set our progress which is progress equal to progress okay so now with this we will get the our progress and we also have other functions which are on download complete on download completed which gives us a string let's say a value what we can do is we can simply print this value let's call this path dollar value which will show us the value which is when our download is completed and we also use our set state and we will make our progress tunal okay so with this we have wrote use this package so now what we can do is we can simply save our project and now with this we'll use our progress let's say if our progress is not equal to null then we will show foreign or we will show our download button okay so now with this we'll save our app again and now what we can do is simply let's see I have an URL here which is of this photo what we can do is we can simply copy this URL and now what we'll do is I'll simply go ahead and paste this URL foreign this URL and now when I'll click on the download button but first open our debugger console and let's click on the download so as you can see we have our progress indicator okay so now as you can see we have the path that we have printed here and our progress is equal to null because we have completed our downloading so now let's what we can do is simply let's go to our gallery and check if we have this file downloaded in our photos so here we go as you can see here we have the image in our photos which is downloaded from the URL so this is how you can use this package to download any type of file in your app but don't forget to add the permissions which is right and freed in your manifest file in Android so that we are able to download and see it in our app so hope you found this video helpful do like share subscribe to my channel and see you in the next video
Info
Channel: Dhanraj Nilkanth
Views: 24,893
Rating: undefined out of 5
Keywords: Flutter Tutorial, android, flutter, flutter dio, flutter dio download file, flutter download, flutter download file from url, flutter download files, flutter download image, flutter download pdf, flutter file download, flutter file open, flutter file path, flutter file picker, flutter file storage, flutter open files, flutter path provider, flutter pdf, flutter pdf download, flutter play video, flutter read files, flutter tutorial, ios, dhanraj nilkanth
Id: LdRdc7JWo3M
Channel Id: undefined
Length: 5min 55sec (355 seconds)
Published: Sat Jan 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.