Skip to content

Commit

Permalink
Added version note about wildcard variables language feature of Dart …
Browse files Browse the repository at this point in the history
…3.7 (#6432)

Co-authored-by: Marya <111139605+MaryaBelanger@users.noreply.github.com>
  • Loading branch information
ViktorVoloshko and MaryaBelanger authored Feb 21, 2025
1 parent 52adad7 commit bb220d8
Showing 1 changed file with 12 additions and 0 deletions.
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

0 comments on commit bb220d8

Please sign in to comment.