Skip to content

[material_ui, cupertino_ui] Recover certain macros that were migrated to avoid @tool leakage #189629

Open

Description

@dkwingsmt

Background

The Flutter framework's API doc has been relying on non-standard directives, such as @tool snippet/sample/dartpad. While migrating directives in the framework to standard dartdoc is generally a long-term goal, some of them are used in @templates and would be leaked into material_ui and cupertino_ui when referenced as macros.

For example, widget CupertinoScrollbar referred to macro flutter.widgets.Scrollbar, which contains a @tool dartpad and a @tool snippet, resulting in the following screenshot:

Image

The following is the full list of such macros:

  • flutter.widgets.EditableText.contextMenuBuilder
  • flutter.widgets.RawAutocomplete.split
  • flutter.widgets.Scrollbar
  • flutter.widgets.Scrollbar.controller
  • flutter.widgets.Scrollbar.thumbVisibility
  • flutter.widgets.editableText.contentInsertionConfiguration
  • flutter.widgets.editableText.onChanged
  • flutter.widgets.scroll_view.anchor

We can't tell dartdoc to "use this template but convert @tool to @example", and therefore have to rewrite the templates. But some of the macros are pretty lengthy, and duplicating them would sacrifice maintainability.

To unblock the v1.0 release, which were pinned to framework v3.44.0, we migrated the affected macros in material_ui and cupertino_ui in flutter/packages#12271 so that they no longer use the macro, but refer to the base widget instead.

What's needed

We should perform the following changes soon:

Once the changes above are rolled into the packages, we should revert the changes to the affected macros in material_ui and cupertino_ui.

Non-goal

After all dartdoc features are supported, we should migrate the entire framework to use standard directives. This is out of the scope of this issue.

Activity

  1. mustafaemirata commented on Jul 17, 2026

    @mustafaemirata
  2. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    p: cupertino_uicupertino_ui package in flutter/packages
    d: api docsIssues with https://api.flutter.dev/
    team-designOwned by Design Languages team
    on Jul 17, 2026
  3. added
    P2Important issues not at the top of the work list
    on Jul 22, 2026
  4. self-assigned this
    on Jul 22, 2026
  5. changed the title [-]Migrate API doc in the framework to standard `dartdoc` directives[/-] [+][material_ui, cupertino_ui] Recover certain macros that were migrated to avoid `@tool` leakage[/+] on Jul 22, 2026
  6. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
  7. guidezpl commented on Aug 24, 2026

    @guidezpl
    Member

    cross-linking dart-lang/dart-pad#3681 for Dartpad support

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

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/p: cupertino_uicupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions