Skip to content

Add a check that all files are exported #108632

Open

Description

@stuartmorgan-g

Per https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#structure

Flutter packages should not have "private" APIs other than those that are prefixed with underscores. Every file in a Flutter package should be exported. ("Private" files can still be imported so they are still actually public APIs; by not exporting them explicitly we are tricking ourselves into thinking of them as private APIs which may lead to poor design.)

We currently have violations of this in at least some of our packages. We also have cases like flutter-team-archive/plugins#6155 where we just forget to export something and have to fix it later.

We could address both issues by having a repo tool command that would validate that for every Dart file in lib/src/ there is a transitive include route from at least one top-level lib/ file. (We need to check all of them to handle deliberate cases of not using the primary export like https://github.com/flutter/plugins/blob/ca63d964d9fdfff9be36533ea4248d0d0ca28fd0/packages/url_launcher/url_launcher/lib/url_launcher_string.dart.) It should probably ignore anything with any import qualifiers (show/hide) since those violate the spirit of the style rule.

Activity

  1. added
    c: contributor-productivityTeam-specific productivity, code health, technical debt.
    p: toolingAffects the flutter_plugin_tools package
    packageflutter/packages repository. See also p: labels.
    P2Important issues not at the top of the work list
    on Jul 29, 2022
  2. added
    P3Issues that are less important to the Flutter project
    and removed
    P2Important issues not at the top of the work list
    on Feb 15, 2024
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

    P3Issues that are less important to the Flutter projectc: contributor-productivityTeam-specific productivity, code health, technical debt.p: toolingAffects the flutter_plugin_tools packagepackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions