is it possible to compile the flutter library

Issue

I am write a flutter public lib, before I commit the code to the repo, I want to compile the whole project. Sometimes I want to make sure all code could compile, for example, after you changed the function the IDE may not give obviously tips somewhere going wrong, is it possible to compile the project? when I am developing a app I could run it, but when I develop a public library I do not know how to run it and check the whole project.

Solution

When making a public package, you should include an example project within it. It’s basically a new flutter project that sits inside the pub project, typically under "example" folder. You can take a look at one of my packages here on GitHub, to get an idea of the folder structure.

If you click into example folder, you will see a complete Flutter project on its own. It has its own pubspec.yaml as well, and refers to the "parent folder" to use the pub package as a demo.

dependencies:
  flutter:
    sdk: flutter
  animated_flip_counter:
    path: ../

Answered By – user1032613

Answer Checked By – Willingham (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *