Adding svg images in Flutter app
In this article we will discuss about how to add svg images in our flutter app.
✨ Summary
Whenever it comes to adding images in our flutter app we usually go for .png, .jpeg, jpg, or .svg images. Each format is unique with their styles.
But most of the developers and designers usually prefer .png or .svg images. The primary reason would be because of their transparent background, but there are many other differences between these two image formats which are listed below as follows., 👇
- PNG (Portable Network Graphics)
Png images offers high-resolution, lossless compression and transparency.
These are raster-based files which usually make them the best choice for adopting in most places.
2. SVG (Scalable Vector Graphics)
These are vector based files, which means that the image is rendered based on mathematical algorithms. This provides with the additional advantage of scaling up or down without negatively impacting their quality. Along with that they too help with SEO(Search Engine Optimization).
Each format comes with their own advantages, If we need high resolution image that can handle multiple colors then .png would be the best choice, where as if we are dealing with logo design, or want to play around with the same image of different sizes without being pixelated then .svg would be the format to consider.
🛠️ Dependencies
🔭 Implementation
- Add the svg image inside the project by creating new folder (assets/Images)
2. Update the pubspec.yaml
file by providing the image file path as follows.
3. Finally render the image in UI using SvgPicture
Well that’s it. 🎉 Run the app to see it in action.🥳
Check out all my Flutter related blogs here.,👇
Other articles you may like.,
🔵Setting up your Flutter app for publishing in Play Store.
🔴Confetti Animation in Flutter
🟡 Change App Launcher Icon in Flutter
🔴 AnimatedContainer Widget in Flutter
Most popular
Flutter Tutorials
If you found this article useful and wish to support my work, you can consider buying me a ☕️ coffee.👇
If you want to know more about Flutter and various Widgets in Flutter…?🤓 Then visit my channel 👉🏻 vijaycreations🚩
Thanks.,