dart-lang / dart-lang/language

Set patterns

Open
#3,296 8 comments 20 reactions 0 assignees View on GitHub
feature patterns
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

Currently, there are Map patterns and List patterns, but no Set patterns. I haven't found an issue tracking this, and I believe this would be a nice feature.

For example, in flutter there is `MaterialStateProperty.resolveWith`, which gives you a set of states that you have to resolve to a certain value (such as a color).
Example usage:
```dart
MaterialStateProperty.resolveWith((states) {
return switch(states) {
{MaterialState.selected, MaterialState.disabled} => Colors.grey,
{MaterialState.selected} => Colors.yellow,
_ => Colors.transparent,
};
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.