Skip to content

Support running analysis and dart doc locally as done on pub #9510

Closed

Description

@Piinks

Having learned from below, this is a feature request to be able to run dart analyze and dart doc as they would be on pub.

Pub changes analysis options to be able to evaluate everything against a single standard.
This can be hard for developers who won't know, or be able to easily validate their expected pub scores.

In the case of material_ui while trying to debug, I learned I would have to..

  • move the package source code out of the mono repo
  • change the analysis options manually adding and removing rules to match pub
  • set up pana
  • run analysis and dart doc

This is really cumbersome just to be able to see what my pub score would be.

Further, if I as a package author publish a package and find out after the fact there was something affecting my score, I'd need to fix it and publish again - hitting pub resources twice for essentially one release.

There should be an option like dart analyze --pub and dart doc --pub or something so I can confidently publish my package without surprises. I would love to have this in CI as well, so that packages accepting contributions can further validate that the standard is maintained before landing a change.


Original issue:

We have been getting the new design packages from Flutter ready to ship, material_ui and cupertino_ui.

Package locations

cupertino_ui is scored better, and already covered by another issue below, but material_ui's score is very poor.
Unfortunately we cannot reproduce all of the issues locally.

Some related issues:

Not represented by an issue above are a few references that cannot be resolved right now because they are coming from the re-export of the widgets library from the core SDK. We opted to keep this export in the initial version of the material_ui and cupertino_ui packages to facilitate an easier migration. We'll remove the export of the widgets library in a future major release.

Those aside though, the failures reported on pub are vastly more than we are seeing locally.

Looking at material_ui (worst-case)

Local Analysis
$ dart analyze
Analyzing material_ui...               4.1s
No issues found!
Local dart doc --dry-run
$ dart doc --dry-run
  warning: internal dartdoc error: Unable to find library for element TargetPlatformVariant.desktop()
    from reorderable_list.ReorderableListView: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/reorderable_list.dart:84:7)
  warning: unresolved doc reference [TargetPlatformVariant.desktop]
    from reorderable_list.ReorderableListView: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/reorderable_list.dart:84:7)
  warning: internal dartdoc error: Unable to find library for element TargetPlatformVariant.mobile()
    from reorderable_list.ReorderableListView: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/reorderable_list.dart:84:7)
  warning: unresolved doc reference [TargetPlatformVariant.mobile]
    from reorderable_list.ReorderableListView: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/reorderable_list.dart:84:7)
  warning: internal dartdoc error: Unable to find library for element AsyncMatcher matchesGoldenFile(Object key, {int? version})
    from material_ui.debugDisableShadows: (file:///Users/katelovett/github/flutter/packages/flutter/lib/src/painting/debug.dart:40:6)
  warning: unresolved doc reference [matchesGoldenFile]
    from material_ui.debugDisableShadows: (file:///Users/katelovett/github/flutter/packages/flutter/lib/src/painting/debug.dart:40:6)
    in documentation inherited from material_ui.debugDisableShadows: (file:///Users/katelovett/github/flutter/packages/flutter/lib/src/painting/debug.dart:40:6)
  warning: internal dartdoc error: Unable to find library for element class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding
    from material_ui.debugDisableShadows: (file:///Users/katelovett/github/flutter/packages/flutter/lib/src/painting/debug.dart:40:6)
  warning: unresolved doc reference [AutomatedTestWidgetsFlutterBinding]
    from material_ui.debugDisableShadows: (file:///Users/katelovett/github/flutter/packages/flutter/lib/src/painting/debug.dart:40:6)
    in documentation inherited from material_ui.debugDisableShadows: (file:///Users/katelovett/github/flutter/packages/flutter/lib/src/painting/debug.dart:40:6)
  warning: unresolved doc reference [TargetPlatformVariant.mobile]
    from paginated_data_table.PaginatedDataTable.primary: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/paginated_data_table.dart:331:15)
    in documentation inherited from paginated_data_table.PaginatedDataTable.primary: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/paginated_data_table.dart:331:15)
  warning: unresolved doc reference [TargetPlatformVariant.mobile]
    from reorderable_list.ReorderableListView.primary: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/reorderable_list.dart:328:15)
    in documentation inherited from reorderable_list.ReorderableListView.primary: (file:///Users/katelovett/github/packages/packages/material_ui/lib/src/reorderable_list.dart:328:15)
Found 10 warnings and 0 errors.

Pub logs

@jakemac53 noticed too that "it is using dart pub get instead of flutter pub get for some reason", not sure if that is contributing

Activity

  1. changed the title [-]Static analysis and dart doc issues on pub cannot be reproduced locally[/-] [+]Support running analysis and dart doc locally as done on pub[/+] on Aug 11, 2026
  2. sigurdm commented on Aug 11, 2026

    @sigurdm
    Contributor

    After dart-lang/pana#1619 this should work as:

    > dart pub global activate pana
    # or for trying the tip-of-tree analysis:
    > dart pub global activate -sgit https://github.com/dart-lang/pana 
    # Followed by
    > dart pub global run pana .
    
  3. Piinks commented on Aug 11, 2026

    @Piinks
    Author

    Wow thank you! Very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions