dart-lang / dart-lang/language
Generative enums don't work if used alongside const constructors of classes
Open
request
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
The code snippet below doesn't work,
```dart
enum Gaps {
one(6);
final SizedBox vBox, hBox, box;
final double size;
const Gaps(this.size)
: box = const SizedBox(width: size, height: size),
hBox = const SizedBox(width: size),
vBox = const SizedBox(height: size);
}
```
It doesn't recognize `size` as constant. Am I missing something here because as far as I understand it is only possible to use generative enums with `const` values.
Contributor guide
Assessment
This issue has not been assessed yet.