Can I constraint a typedef to range of integers in Dart?
Like shown in this TypeScript SO answer
type MyRange = 5|6|7|8|9|10
let myVar:MyRange = 4; // oops, error :)
I would like to limit:
Dice dice = 0; // warning not compile
Dice dice = 1;
Dice dice = 2;
Dice dice = 3;
Dice dice = 4;
Dice dice = 5;
Dice dice = 6;
Dice dice = 7; // warning not compile
Like:
typedef Dice = 1|2|3|4|5|6
Is it possible in Dart somehow?