Movatterモバイル変換


[0]ホーム

URL:


Package scores & pub points#

NOTE: The Pub scoring model evolves over time, and is likely to be extendedwith additional checks in the future.

For each package, this site displays three scoring dimensions. These aredisplayed in search results, in the sidebar on individual package pages, and infull detail in the scoring report on the 'Scores' tag of an individual package.The three dimensions are:

  • Likes: A measure of how many developers have liked a package. Thisprovides a raw measure of the overall sentiment of a package from peerdevelopers.
  • Pub Points: A new measure of quality. This includes several dimensionsof quality such as code style, platform support, and maintainability. Moreabout this below.
  • Download count: A measure of how often a package is downloaded,providing insight into what other developers are using.

Likes#

Likes offer a measure of how many developers have liked a package. To like apackage, locate thethumbs up button located in the upper-right corner of apackage page.

To view packages you have liked, use theMy pub.dev > My liked packages menuoption.

Download counts#

Pub.dev tracks and stores how many times each version of each package gets downloaded. This is used to display package usage metrics.

The displayed download counts on pub.dev are aggregates based on raw server-side numbers counting the times a package archive has been downloaded from the server.

The download count is not a direct measure of how many users a package has. A package can have a high usage with relatively low download counts, because the pub client caches the downloads in thePUB_CACHE. This is a shared cache, so a particular package version will only be downloaded once per user on a particular developer machine, even if the user invokespub get many times across different projects.

On the other hand, for some packages the download count may be relatively high. For instance, the number can be high if the package is used as a dependency by other popular packages. The download counts can also be highly affected if the package is used by CI systems running tests, since these systems typically don't retain thePUB_CACHE between test runs.

The download count is not a perfect metric, and should only be regarded as an indicator of popularity.

Pub Points#

Pub points is pub.dev's measure of quality. Pub points are awarded in sixcategories:

Follow Dart file conventions#

Dart packages are expected to follow certain file conventions for how toorganize a package.Most importantly make sure to:

Provide documentation#

This category measures if a package has documentation in two areas:

  • The package has an illustrative code example. See thelayoutdocumentation fordetails about where to place this example.

  • At least 20% of the public API members containAPIdocumentation.

Platform support#

Packages are encouraged to support multiple platforms, to enable app developersto support a wide variety of platforms for their apps. This includes Dart'snative and web platforms, and Flutter'smobile,web, anddesktop targets.

pub.dev knows about the following platforms:

  • Windows
  • Linux
  • macOS
  • Android
  • iOS
  • Web

And the two SDKs:

  • Flutter
  • Dart

The platform support will be detected by analyzing the transitive import graphof the top-level libraries, and finding what core libraries are used. (e.g. apackage importingdart:html does not support the 'windows' platform).

If you need to import different libraries for specific platforms (e.g. on theweb vs on devices), you can use Dart'sconditionalimports.

Declaring platforms:

For packages that make sense or only have implementation on a subset ofplatforms the detected platform support can be overridden with a platformdeclaration in thepubspec.yaml file:

  • Flutter plugins declare their platforms by theflutter.plugin.platform key.

  • Packages using FFI or otherwise being platform-specific can declare theirplatform support using a top-level [platforms] declaration:

    # This package works only on Windows and Linux.platforms:   windows:  linux:

Pass static analysis#

Static analysis is used to determine of the package contains any errors,warnings, and lints (code style issues).

To validate a package prior to publishing, rundart analyze (Dart SDK) /flutter analyze (Flutter SDK), and fix the items it returns.

For code style, make sure to familiarize yourself with theDart styleguide.

Your package will be analyzed against the lints in the standardlints package. Lookhere to learn how toenable the same lints locally.

Support up-to-date dependencies#

This category measures if a package has up-to-date dependencies in three areas:

  • Works with the latest stable Dart SDK.
  • Works with the latest stable Flutter SDK (if applicable).
  • Works with the latest versions of all dependencies.

To determine if your package supports the latest versions of dependencies priorto publishing, run thepub outdated command (Dart SDK) orflutter pub outdated command (Flutter SDK).

Calculating pub points prior to publishing#

The pub.dev site uses the analysis toolpana to calculate pubpoints. This is run automatically on the pub.dev site whenever you publish a newpackage, or a new version of an existing package.

You can view yourpub points report to get suggestions before publishing, byrunningpana locally:

  1. When runpana will make modifications to the package, so start by makinga copy of the directory holding your package:cp ~/dev/mypkg ~/tmp/mypkg

  2. Make sure you have the latest pana tool:dart pub global activate pana (panachanges frequently, so run this again frequently to update the pana tool)

  3. Run pana on the copy we made earlier:dart pub global run pana ~/tmp/mypkg


[8]ページ先頭

©2009-2026 Movatter.jp