Sitelet https://github.com/flutter/flutter/pull/190481
Skip to content

Move examples/api to packages/flutter/examples/api and fix CI errors - #190481

Merged
auto-submit[bot] merged 12 commits into
flutter:masterfrom
dkwingsmt:move-examples-to-flutter
Aug 7, 2026
Merged

auto-submit[bot] merged 12 commits into
flutter:masterfrom
dkwingsmt:move-examples-to-flutter

Conversation

@dkwingsmt

@dkwingsmt dkwingsmt commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

This PR moves API examples from <root>/examples/api to <root>/packages/flutter/examples/api.

This change is required because the standard dartdoc directive {@example} requires API examples to reside within the package directory. For more details, see issue #189629 (item 1 under "What's needed").

Summary of changes

Moved all API example files to packages/flutter/examples/api.

Updated related scripts and CI configurations to reflect the new directory structure.

  • Most changes involve simple path updates from examples/api to packages/flutter/examples/api.
  • Some adjustments were more complex because the examples, which previously resided in a single <root>/examples directory, are now split across two separate locations.

Existing paths in "See code in " directives are retained. These paths are now treated as relative to the package root rather than the repository root. For example, the following API doc comment remains valid despite the file move:

  /// Class definition.
  ///
  /// {@tool sample}
  /// An example.
  ///
  /// ** See code in examples/api/lib/widgets/foo/foo.0.dart **
  /// {@end-tool}

Three API doc tests are now marked as reduced-test-set because they're now facing additional analysis for being under packages/flutter.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 3, 2026
@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels. a: animation Animation APIs p: material_ui material_ui package in flutter/packages a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) f: scrolling Viewports, list views, slivers, etc. p: cupertino_ui cupertino_ui package in flutter/packages f: routes Navigator, Router, and related APIs. a: desktop Running on desktop f: focus Focus traversal, gaining or losing focus d: docs/ flutter/flutter/docs, for contributors labels Aug 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request relocates the examples/api directory to packages/flutter/examples/api and updates all associated CI configurations, labelers, analysis scripts, tests, and documentation to reflect this new path. The review feedback points out several incorrect path prefixes and relative paths introduced in .github/labeler.yml and dev/bots/analyze_snippet_code.dart that require correction.

Comment thread .github/labeler.yml Outdated
Comment thread .github/labeler.yml Outdated
Comment thread dev/bots/analyze_snippet_code.dart Outdated
@dkwingsmt

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request relocates the API examples from the root examples/api directory to packages/flutter/examples/api, updating various CI configurations, analyzer scripts, and tests to reflect the new path. The review feedback highlights potential Windows-specific path issues in check_code_samples.dart and its tests, where backslashes in paths on Windows could cause prefix matching and string comparison failures. Code suggestions are provided to normalize path separators to forward slashes.

Comment thread dev/bots/check_code_samples.dart Outdated
Comment thread dev/bots/test/check_code_samples_test.dart Outdated
@dkwingsmt

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request relocates the API examples from examples/api to packages/flutter/examples/api and updates the CI targets, labeler configuration, analysis scripts, snippet tools, and tests to use the new path. Feedback on the changes suggests skipping all File entities early in the cross-import checker loop to prevent type errors with non-Dart files, and normalizing paths to use forward slashes in the code sample tests to simplify the logic.

Comment thread dev/bots/check_examples_cross_imports.dart
Comment thread dev/bots/test/check_code_samples_test.dart Outdated
@dkwingsmt

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request relocates the API examples directory from examples/api to packages/flutter/examples/api and updates associated CI configurations, analysis tools, tests, and documentation to reflect the new path. Feedback suggests checking if the API documentation directory exists before adding it to the list of example files to prevent potential runtime exceptions.

Comment thread dev/bots/check_examples_cross_imports.dart
navaronbracke
navaronbracke previously approved these changes Aug 5, 2026

@navaronbracke navaronbracke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming the added reduced test set tags in the handful of tests are intentional.

Also, note for reviewers, Github does not seem to like the sheer size of the diff (even if 99% is moves/renames). The Github UI gets a little janky

@navaronbracke

Copy link
Copy Markdown
Contributor

Dashboard checks hit an infra failure it seems. And this'll also need an override label for the code freeze I suppose

@dkwingsmt
dkwingsmt requested review from Piinks and justinmc August 7, 2026 02:52
justinmc
justinmc previously approved these changes Aug 7, 2026

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@dkwingsmt dkwingsmt added override code freeze Override an active code freeze. autosubmit Merge PR when tree becomes green via auto submit App labels Aug 7, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Aug 7, 2026
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2026

@jtmcdole jtmcdole left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LGTM exchange rates are currently trading at:

  • 1 LGTM = golden images match closely enough if I squint.
  • 2 LGTMs = I checked that this won't break the devicelab benchmarks
  • 3 LGTMs = I trust that this C++ pointer won't leak memory every frame.
  • 4 LGTMs = CI is green on the first try without a single retry or shard failure
image_1786120554622963

@jtmcdole jtmcdole added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 7, 2026
Merged via the queue into flutter:master with commit 0feeeab Aug 7, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2026
pull Bot pushed a commit to Mu-L/flutter that referenced this pull request Aug 13, 2026
… whitelist (flutter#191025)

In flutter#190481, the API docs were
moved from `<repo_root>/examples/api` to
`<repo_root>/packages/flutter/examples/api`.

`flutter create` is typically forbidden within Flutter's repo except for
a few whitelisted directories. With the aforementioned migration, the
whitelist should include the new API doc package as well.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
stucdio added a commit to stucdio/flutter that referenced this pull request Aug 23, 2026
Upstream master moved examples/api to packages/flutter/examples/api
(flutter#190481) while this PR was open. Merging master in left this PR's two
new files (added after that move, so not covered by its rename
detection) stranded at the old, now-unused examples/api path. Move
them to match every other example under the flutter_api_samples
package.

The `** See code in examples/api/... **` doc references in
container.dart are unchanged: they're resolved relative to the
package root, which is exactly what moved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: animation Animation APIs a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems c: contributor-productivity Team-specific productivity, code health, technical debt. CICD Run CI/CD d: docs/ flutter/flutter/docs, for contributors f: focus Focus traversal, gaining or losing focus f: routes Navigator, Router, and related APIs. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. override code freeze Override an active code freeze. p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants