vijaycreations
Published in

vijaycreations

Adding svg images in Flutter app

In this article we will discuss about how to add svg images in our flutter app.

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., 👇

  1. 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.

  1. 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.🥳

--

--

A list of Flutter Tutorials and app templates

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vijay R

Hai👋 I’m a flutter developer experienced in designing and developing stunning mobile apps. Reach out for freelance projects: vijaycreations02@gmail.com