How to Reduce the Size of Your Flutter Package | by Matthew Croak | Feb, 2022

Straightforward peasy file measurement squeezy

Photograph by Brian Kostiuk on Unsplash

pubignore

The very first thing to do is replace your .pubignore file. Put something you don’t need or want pub.dev to find out about right here. By placing these recordsdata right here they received’t be thought of within the bundle publishing course of.

Instance of .pubignore file.

flutter clear

THIS! This was extremely useful for me. The command flutter clear works by deleting varied directories in your Flutter app that aren’t wanted for publishing. In line with this post on Flutter Company, “After executing the flutter clear command we’d see that it’s going to delete the dart-tools folder, android folder, and iOS folder in our utility with debug file.”

instance

For those who’re publishing a bundle to pub.dev, it will be significant that you’ve got an instance listing within the root of your challenge. This manner it’ll present up beneath the instance tab on pub.dev.

Instance of instance tab for google_fonts flutter bundle.

git

You can even take away the challenge measurement by eradicating unneeded cached data from the git historical past. To do that you possibly can merely kind the beneath in your command line.

git rm -r--cached

More Posts