Skip to content

feat: add new API documentation examples for scroll notifications, UI…#188249

Open
himanksharma8434-coder wants to merge 1 commit into
flutter:masterfrom
himanksharma8434-coder:master
Open

feat: add new API documentation examples for scroll notifications, UI…#188249
himanksharma8434-coder wants to merge 1 commit into
flutter:masterfrom
himanksharma8434-coder:master

Conversation

@himanksharma8434-coder

Copy link
Copy Markdown

Description
This PR refactors several API examples to use debugPrint() instead of raw print() statements. In Flutter, using raw print() is discouraged because Android's kernel truncates console outputs that exceed standard logcat limits, which can silently hide valuable debugging information for developers reading the examples. By updating scroll_controller_notification.0.dart, ui_testing_with_text.dart, and dropdown_menu_entry_label_widget.0.dart to use debugPrint(), this PR ensures these official API examples adhere to the framework's recommended logging best practices and prevent unintentional log truncation.

Before/After Examples
Before (Legacy):

dart
onSelected: (ColorItem? color) {
print('Selected $color');
},
After (Updated):

dart
onSelected: (ColorItem? color) {
debugPrint('Selected $color');
},
Related Issues
This PR fixes a trivial logging anti-pattern (swapping raw print() for debugPrint() in API examples) to align with framework standards. As a minor code cleanup, there is no associated open issue.

Breaking Changes
Not applicable. This PR only updates internal logging in example files and does not contain any breaking API changes or modifications to the flutter/tests repository.

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. 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.

… testing with Text, and dropdown menu entries
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@google-cla

google-cla Bot commented Jun 19, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@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 replaces occurrences of print with debugPrint across several example API files, including dropdown_menu_entry_label_widget.0.dart, scroll_controller_notification.0.dart, and ui_testing_with_text.dart. There are no review comments, and I have no feedback to provide.

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jun 19, 2026
@fluttergithubbot

Copy link
Copy Markdown
Contributor

An existing Git SHA, bc1c2995f2a0d0a86bb05ecba08e0942e2f7dd96, was detected, and no actions were taken.

To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with --force) that already was pushed before, push a blank commit (git commit --allow-empty -m "Trigger Build") or rebase to continue.

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

Labels

a: text input Entering text in a text field or keyboard related problems d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants