Update: starting from January 2022, pub.green is discontinued.
Pub.green was a project that ran for one year. Unfortuntely, it never got enough traction, so Codemagic team decided to no longer support it. Perhaps, we will find a way to continue it in the future.
What is pub.green?
Pub.green is a site that tests the compatibility of Flutter and Dart packages available on pub.dev with different Flutter versions. When choosing which packages to use in your next Flutter app, you can refer to pub.green to understand if the package has any compatibility issues with the Flutter channel or version you’re using.
Why we built it?
When we started our ongoing cooperation with Google as the issue triage partner in several Flutter repositories, we witnessed the real-life problems that many Flutter developers experience with their app dependencies. Upgrading to a newer Flutter version often breaks the app due to packages having compatibility issues with the new Flutter version. While the plugins and packages developed by flutter.dev are usually kept up to date with breaking changes in Flutter, not all third-party package authors or maintainers are as fast to respond.
Having in place a product and infrastructure to easily build Flutter applications and packages gave us an idea to run regular compatibility checks on packages against the Flutter channels and versions. The result of this idea is a site similar to caniuse.com which web developers use to learn about the compatibility of a technology or library with all the mobile and desktop browsers. Pub.green focuses on Flutter and the packages published to pub.dev.
You can think of pub.green as an extension of pub.dev. In addition to the quality and popularity scores on pub.dev that you can rely on when choosing packages for your app, pub.green adds another layer of quality checks. Unlike a regular CI setup which triggers builds on code changes, the compatibility checks are run whenever there’s a new version of Flutter or the package released thanks to the integration with pub.dev and monitoring of Flutter SDK updates.
The next major breaking change in Flutter is the transition to null safety which requires packages to be migrated to use non-nullable types. However, not all packages on pub.dev have a null-safe version available yet.
How does it work?
We’ve taken the 1,000 most popular packages from pub.dev and set up CI for them on Codemagic. Our automated configuration file generation logic analyzes the source code of the package and creates a codemagic.yaml configuration file suited to build the provided example application.
Every time a new version of a package is released, pub.green validates it and builds its example application with the latest version of Flutter on beta and dev channels as well as with the two latest Flutter versions on stable channel (the current latest release and the latest release of the previous major version). The same happens when there is a new Flutter version available on any of the channels which then triggers a build for the latest version of the package. The example app is currently built for Android, iOS and the web platform. In addition, we run static code analysis, the tests that are present and show the test coverage percentage.
Based on the build result, the compatibility status for the tested package / channel / Flutter version combination can be one of the following:
- Green = compatible: no issues were found, the example application (if provided) built fine for all the tested platforms
- Yellow = possible issues: there were no build errors but some tests failed or the analyzer found issues
- Red = compatibility issues: version resolving failed or build failed for one or all tested platforms
More details, log outputs for all the build steps as well as the Codemagic configuration file are available when clicking on the result in the table.
How can package maintainers interact with pub.green?
The codemagic.yaml file which is used to configure the build in Codemagic is available for every package and can be viewed in the browser or downloaded. It gives an overview of all the commands that were run during the CI build. Package authors or maintainers can do the same validation by running the commands locally. It’s worth pointing out that CI builds take place in a clean environment that has no knowledge of your local setup. If you do find issues with the build results or setup on pub.green, please let us know by sending an email to firstname.lastname@example.org.
In addition, package maintainers can display the latest compatibility result for a Flutter channel as a status badge in their package’s readme. The available statuses are “issues reported”, “possible issues” and “no issues”. Clicking on the status badge takes to the respective compatibility table in pub.green. You can see the markdown snippets for status badges at the bottom of the page for every package.
The next steps
Pub.green currently validates 1,000 packages on Android, iOS and web and can be extended to validate more packages and support more platforms in the future. We have already received some initial feedback from package authors and are grateful for their input and ideas about how to make pub.green better. If you have feedback or suggestions, let us know!