Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added version note about wildcard variables language feature of Dart 3.7 #6432

Merged
merged 4 commits into from
Feb 21, 2025

Conversation

ViktorVoloshko
Copy link
Contributor

@ViktorVoloshko ViktorVoloshko commented Feb 18, 2025

Dart 3.7 added wildcard variables language feature that prevents _ identifiers from actually declaring a variable. So multiple _ in a single callback now possible.

Added version note about this to according guideline.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
  • This PR doesn't contain automatically generated corrections or text (Grammarly, LLMs, and similar).
  • This PR follows the Google Developer Documentation Style Guidelines — for example, it doesn't use i.e. or e.g., and it avoids I and we (first person).
  • This PR uses semantic line breaks of 80 characters or fewer.
Contribution guidelines:
  • See our contributor guide for general expectations for PRs.
  • Larger or significant changes should be discussed in an issue before creating a PR.
  • Code changes should generally follow the Dart style guide and use dart format.
  • Updates to code excerpts indicated by <?code-excerpt need to be updated in their source .dart file as well.

@MaryaBelanger MaryaBelanger self-assigned this Feb 18, 2025
@MaryaBelanger
Copy link
Contributor

/gcbrun

@dart-github-bot
Copy link
Collaborator

dart-github-bot commented Feb 18, 2025

Visit the preview URL for this PR (updated for commit a75b9fb):

https://dart-dev--pr6432-patch-1-kko7bhnz.web.app

@MaryaBelanger
Copy link
Contributor

Thank you for noticing this @ViktorVoloshko, great catch! This is definitely important to update.

@munificent, what do you think about me rewriting the section completely? Or maybe removing it?

For a rewrite, it could a bunch of different ways:

  • DON'T use _, __, etc. for unused callback parameters
  • DO use wildcard variables for unused callback parameters
  • ??

Or, we could leave it as-is with a note like the one in this PR (I'd move it right under the section heading), with a plan to remove/change/update later, when we're further from the latest version release?

@MaryaBelanger MaryaBelanger linked an issue Feb 21, 2025 that may be closed by this pull request
@parlough parlough marked this pull request as ready for review February 21, 2025 18:02
Copy link
Contributor

@MaryaBelanger MaryaBelanger left a comment

Choose a reason for hiding this comment

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

Thank you @ViktorVoloshko! I'm going to merge this PR. Other stakeholders: I might open another PR to change the title of this section all together; will link to here for reference

@MaryaBelanger
Copy link
Contributor

/gcbrun

@MaryaBelanger MaryaBelanger merged commit bb220d8 into dart-lang:main Feb 21, 2025
10 checks passed
@ViktorVoloshko ViktorVoloshko deleted the patch-1 branch February 21, 2025 20:40
@munificent
Copy link
Member

Sorry for the delay, I was out all week. I agree that rewriting it eventually would be good. I would probably change the guideline to "PREFER using _ for unused callback parameters".

Then in the prose mention that if targeting Dart < 3.7 that you may need to use __, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update dart style recommendation for wild cards
4 participants