dart-lang / dart-lang/language
Set patterns
Open
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
Assessment
This issue has not been assessed yet.