Sub topic 3
Choosing a Package: Score, Likes, Publisher, Platforms
This chapter assumes you can create a Flutter project, run commands in a terminal, and read a pubspec.yaml file. Adding a package is cheap, but removing one later is not. A package you add becomes code you ship, update, and depend on. Spend a few minutes checking it before you run flutter pub add.
This chapter covers the signals pub.dev shows on every package page, what each one tells you, and where each one misleads. It ends with a checklist you can apply in about five minutes.
What the package page tells you
Every package on pub.dev has a page with a header, a set of tabs, and a sidebar. The signals you need are spread across them.
- The header shows the name, the latest version, the publisher, and the platforms and SDKs it supports.
- The Readme, Changelog, Example, Installing, Versions, and Scores tabs sit below the header.
- The sidebar shows the repository link, the issue tracker, the license, and the dependencies.
Start with the header and the Scores tab. Then look at the repository.
Pub points, likes, and popularity
pub.dev reports three numbers. They measure different things, so do not read them as one rating.
| Signal | What it measures | What it can tell you | What it cannot tell you |
|---|---|---|---|
| Pub points | Up to 160 points from automated checks | The package follows Dart conventions, has documentation, supports platforms, and passes static analysis | Whether the code is correct or well designed |
| Likes | How many users clicked the like button | People found it worth endorsing | Whether people still use it, or whether it fits your case |
| Popularity | A percentage based on how many apps use the package | Many projects depend on it, so problems tend to be found and reported | Whether it is maintained today |
Pub points
Pub points come from an automated analysis. The checks cover areas such as:
- following Dart file conventions (a valid
pubspec.yaml, a README, a changelog, and an example) - documentation of the public API
- platform support
- passing static analysis
- supporting up-to-date dependencies
Open the Scores tab to see which checks failed. A package with 150 of 160 points is usually fine. What matters is the reason for the missing points. A missing example is minor. Failed static analysis or an out-of-date dependency constraint deserves a closer look.
Likes
Likes are a count of explicit endorsements. They favor older packages, because a package that has existed for years has had more time to collect them. A new package with excellent code may have few likes. An old, abandoned package may have many.
Popularity
Popularity is a relative measure of use. A high popularity is useful for a practical reason: widely used packages have more people filing bugs, so issues are found and fixed sooner. It also means more answers on forums and Stack Overflow.
<br>
Treat the three numbers as filters, not as a ranking. A package with high popularity and decent points passes the first filter. Everything after that comes from reading more closely.
Publisher and verified identity
A package can be uploaded by an individual account or by a verified publisher. A verified publisher is a domain, such as dart.dev or firebase.google.com, whose ownership has been proven. pub.dev shows a small badge and the domain next to the package name.
A verified publisher tells you who is responsible for the package. It does not tell you the package is good. It helps you in two ways.
- It makes impersonation harder. A package named like a well-known library but published by an unrelated account stands out.
- It identifies an organization that has a reputation to protect, and often a team that can take over if one maintainer leaves.
Packages from an individual are not bad. Many excellent packages come from single maintainers. In that case, check the maintenance signals described below more carefully.
Platform and SDK support
The header lists the platforms a package supports: Android, iOS, Linux, macOS, web, and Windows. It also lists whether it works with Dart, Flutter, or both. Check this against the platforms your app targets.
The most common mistake is to add a package that works on mobile and then discover it fails on web or desktop. For a plugin, a missing platform usually means the code throws a MissingPluginException at runtime. It does not usually fail at build time.
You can filter search results on pub.dev by platform, SDK, and other tags, such as null safety and Dart 3 compatibility. Use the filters before you read individual pages.
Also look at the SDK constraints in the Installing tab or the pubspec.yaml shown on the page. These are the Dart and Flutter versions the package requires. If your project uses an older SDK than the package requires, pub get will fail.
Packages versus plugins
The platform list matters more for plugins than for plain packages.
- A package is written only in Dart. If it supports Flutter, it generally runs on every platform Flutter supports.
- A plugin is a package that also contains platform-specific code, such as Kotlin or Swift. It runs only on the platforms its authors implemented.
A plugin's platform badges reflect real implementations. If iOS and Android are listed and web is not, then you can expect failures on web. Federated plugins split the work into separate packages, one per platform, so the page may list several related packages. The app-facing package pulls in the platform packages you need.
Maintenance signals
The numbers on pub.dev do not show whether anyone is looking after the code. You have to check this yourself.
- Version date. The Versions tab shows when each release was published. A package that is stable and feature-complete can be fine without updates for a year. A package that interacts with Android or iOS and has not been updated for two years probably will not keep working with new OS releases.
- Changelog. A clear changelog suggests care. Look for notes on breaking changes and fixes.
- Repository activity. Follow the repository link. Check recent commits, and whether pull requests are being merged.
- Issue tracker. Look at the open issues. Many open issues are normal for a popular package. Look at whether maintainers respond, and whether there are unanswered reports of crashes.
- Discontinued flag. pub.dev marks a package as discontinued when its author retires it. It is often shown with a suggested replacement. Do not add a discontinued package to a new project.
A package marked Flutter Favorite was reviewed by the Flutter ecosystem committee against quality criteria. This is a strong positive signal, but not every good package has it.
Checking the dependencies and license
Open the sidebar and review two more items.
- License. Look for a permissive license such as BSD, MIT, or Apache 2.0. If your app is closed source, a copyleft license may create obligations. Read the license, and ask your legal contact if you are unsure.
- Dependencies. The Dependencies list shows what the package pulls in. Each one adds to your app size and your chance of a version conflict. A small helper that depends on ten other packages deserves a second thought.
A worked decision flow
The following flow turns the signals into a decision. It is a rule of thumb, not a rule.
Common errors when choosing
- Choosing by likes alone. An old package with many likes may be unmaintained and incompatible with current SDKs.
- Ignoring platform badges. The app compiles, then fails on the one platform you did not check.
- Trusting similar names. Check the publisher and the repository link before you add a package whose name resembles a famous one.
- Reading only the README. READMEs describe what the author hopes the package does. The issue tracker shows what it does.
- Adding a package for a few lines of code. If you need one small function, writing it yourself may cost less than carrying a dependency.
Checking from the command line
Once you have added a package, you can see what you pulled in. The flutter pub deps command prints the dependency tree.
flutter pub deps --style=compactRun this after adding a package. If the list is much longer than you expected, reconsider your choice. A later chapter covers flutter pub outdated, which shows how current your dependencies are.
Exercise
You are choosing between two packages for local notifications in an app that targets Android, iOS, and web. Package A has 140 pub points, 9,000 likes, a verified publisher, and lists Android and iOS only. Package B has 130 pub points, 600 likes, an individual publisher, and lists Android, iOS, and web, with a release last month. Which do you investigate first, and what would you check before adding it?
Show answer
Investigate Package B first, because Package A does not list web and would fail there, probably with a MissingPluginException. For B, check the repository for recent commits and maintainer responses on issues, look at the Scores tab to see which 30 points are missing, confirm the license, and review its dependencies. Because the publisher is an individual, the maintenance signals carry more weight. If B fails these checks, look for a different package that supports all three platforms.
Exercise
Name two things the pub points score does not tell you about a package, and where on pub.dev or elsewhere you can find each.
Show answer
It does not tell you whether the code is correct or whether the package is actively maintained. Maintenance shows in the Versions tab, the Changelog, and the repository's commit history and issue tracker. Correctness is best judged by reading the example, the tests in the repository, and the open bug reports.