0

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.

1
  • not great, the chinese style english. Please do not make fun of me.@user1032613
    – Dolphin
    Commented Mar 26, 2022 at 2:31

2 Answers 2

1

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: ../
1
  • I have a clue what should I do, maybe try this way later.@user1032613
    – Dolphin
    Commented Mar 26, 2022 at 2:33
0

Check the docs about writing packages. https://docs.flutter.dev/development/packages-and-plugins/developing-packages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.