Flutter Tutorial - Share File, Image, Text, URL | The Right Way | WhatsApp, Facebook, Instagram

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
how to share data images and texts in flutter to other apps on your device such as whatsapp facebook instagram and many more for this we make use of the share plus package if we click here on this button then we simply want to call the share method from this package and here inside you can then put a text inside which should be shared most of the time you want to share next to the text also a link and therefore we want to define here a url and this url we simply define here at the top which is in this case a youtube video and with this if you click on this share button then we show here a sharing dialog and the user can select here then any app to which you want to share this data so in this case he choose then for example whatsapp and then he can select here a user to which you want to share this data and lastly the data is then here displayed inside of our chat if you also pass here a link inside then you have here most of the times also a preview of this link at the top next we also want to share any files such as images videos pdfs and many more first of all we have here an image which is stored in the internet and now we want to basically download this file and therefore you can simply make use of this http package and with this you can then basically get here the bytes of this image and lastly you also need to save them these bytes inside of your local storage on your phone and therefore we simply get here a temporary directory where we simply save then our file here inside of this pass and therefore we simply write here our bytes to this path and lastly we can then use this path to share our file therefore we take in this case the share files method and here you put then the text inside and also the path of the file that you want to share and with this if you click this time on the share button then you can simply share the whole image itself so in this case the whole image is then shared for example here to instagram and later this image is then uploaded here to our feed all in all to make use of this code you need to have here the http package and the pass provider for saving the file therefore simply go inside of your pubspec yammer file and here under your dependencies you want to include them these both packages and of course you also need to have the share plus package for sharing some data to other applications and finally we want to pick some files directly from our device storage and the gallery and therefore we also want to make here use of these both packages the file picker and the image picker let's start by picking first of all some images from the gallery and therefore you simply use the image picker package and here inside of this pic image method you can then define that we want to choose it from the gallery alternatively you can also choose your image directly from the camera and finally if the user has then picked an image from the gallery or the camera then we also want to share here our file and therefore we can simply access here the path of this picked image and with this if we click on the share button the user can pick an image from the gallery and after it he can then share it to any social media in case you want to pick instead videos from the gallery then you can also use here this pick video method in case you want to pick any files from your device's local storage therefore you use the file picker and here with the pic files we get then basically some files back and we simply get here then all the files and lastly you only need to put here then the files inside of the share files method and with this we can pick any files from our local storage and then share it to our social media if you like you can also define here the type of the file that the user can pick and that you want to share so in this case the user can share only images however you have many different options here in case you want to take screenshots and share them to social media then simply check out here this video and by the way if you want to get here this whole source code of this application then you can get it with the first link in the description and with the second link you can get access to my flutter courses where i teach you how you can become a better and more efficient developer if you like this video make sure to subscribe to my youtube channel [Music] you
Info
Channel: HeyFlutter․com
Views: 51,838
Rating: undefined out of 5
Keywords: android, flutter, flutter share, flutter share facebook, flutter share file, flutter share image, flutter share image and text, flutter share plugin, flutter share screenshot, flutter share social media, flutter share text, flutter share whatsapp, ios, share, share data with app, share data with other apps, share image, share in flutter, social media, whatsapp share flutter
Id: CNUBhb_cM6E
Channel Id: undefined
Length: 4min 43sec (283 seconds)
Published: Fri Sep 10 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.