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
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/content/effective-dart/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,18 @@ In contrast, top-level functions and method declarations don't have that context
so their parameters must be named so that it's clear what each parameter is for,
even if it isn't used.

:::version-note
Since Dart 3.7, the [wildcard variable `_`][] no longer creates a variable, so you can
use `_` for multiple parameters simultaneously without name collision:

```dart tag=good
(_, _) {
print('error');
}
```
:::

[wildcard variable `_`]: /language/variables#wildcard-variables

### DON'T use a leading underscore for identifiers that aren't private

Expand Down