问题
what is the best way to test a pub lib package before deploy, as if I had downloaded it via pub install? (not talking about unit tests)
回答1:
You can use path packages. Instead of going through a pub server this will fetch the package from the local filesystem.
回答2:
It very much depends on the type of package you are looking to use.
If the pub package is primarily a non-UI library then you should be able to exercise its API via a UnitTest script, a small script that has a main to kick off a bunch of unit tests (grouped or otherwise).
Another option for a non-UI package is to find the source project (usually noted in the package's page on pub.dartlang.org) and download it, where if you're lucky there will be a test directory with a unit test script in it.
Some UI providing packages do include unit tests in their project too.
A lot of projects include an example or two you can run to see how it works and pick up some tips from their source code, so I encourage you to check out the original source of the project you're interested in.
But generally (especially for UI providing packages), you're going to get best results by creating a small skeleton app for the purpose of playing with the package and then apply what you learn to your main application.
Hope that helps.
来源:https://stackoverflow.com/questions/17422956/how-to-test-dart-pub-lib-package-before-deploy