enum Foo {
bar,
baz,
}
By just simply looking at this code, I thought it would print bar, baz
and then barr, bazz
void main() {
final f = Foo.bar;
switch (f) {
case Foo.bar:
case Foo.baz:
print("bar, baz");
}
switch (f) {
case Foo.bar:
if (false) {
return;
}
case Foo.baz:
print("barr, bazz");
}
}
It seems obvious right ? if (false) is never called, so it won’t return, it will fall to the next switch case.
But no . It prints bar, baz
What are the two code block not equivalent ? What is the design choice behind this and how does it compare to other languages. Or this is just Yet another Dart bug