Including assets in a Flutter package

Suragch
Flutter Community
Published in
8 min readDec 1, 2019

--

A guide for package developers

Photo by Bench Accounting on Unsplash

If you are coming to this page wanting to know how to include images, fonts, or other assets in your Flutter app, then you might be in the wrong place. Check out one of these other articles for help:

The guide below is for package developers who need to include assets in their package.

Where to put the assets

So you have an image or font or something that you want to make available to the app developers who use your package. Where do you put it?

One choice is to put it in the lib/ folder.

Who knew that you could put something besides .dart files in the lib/ folder!

Anything in the lib/ folder will get automatically bundled with the app. Those assets will be available to anyone who uses your package. As the package developer, you don’t even need to declare those assets in pubspec.yaml if you are not using them yourself. They’ll still be bundled…

--

--