Recently I was working on a client’s project where I needed to build a chat app. Now in the app, we have text, images, audios and videos. For text and images, I found ways where I can make them available locally and play from local directory (for image I used Network to File Image). When it came to audio and video files, I could not find any package. So now what? Let’s build one.
In this post I would just share the repository of the package, but perhaps in another article, I would explain how it is implemented and make a package of it.
Here is the repository: Network to Local File
Here is an example on how you can use it:
Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ //Image NetworkToLocal( mediaURL: 'https://smart-y.fra1.digitaloceanspaces.com/ChatMedia/84050157-ef7c-47a9-84f8-45b13584f747.jpg', mediaType: 'image', ), //Audio NetworkToLocal( mediaURL: 'https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3', mediaType: 'audio' ), //Video Expanded( child: NetworkToLocal( mediaURL: 'https://assets.mixkit.co/videos/preview/mixkit-forest-stream-in-the-sunlight-529-large.mp4', mediaType: 'video' ), ), ], ),