Description
Seeing this using dartpad: https://dartpad.dartlang.org/ (Based on Dart SDK 1.25.0.)
Also seeing in Flutter:
Flutter 0.3.1 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 12bbaba (4 weeks ago) • 2018-04-19 23:36:15 -0700
Engine • revision 09d05a3891
Tools • Dart 2.0.0-dev.48.0.flutter-fe606f890b
I am developing on a Mac.
When I have a switch statement over an Enum, that is exhaustive, if each branch of the switch case has a return statement, I still get an info
in the compiler indicating the function does not end with a return statement. Inserting a return statement at the end of the function removes this error, despite the fact that I believe this statement cannot execute under any circumstances.
This is demonstrated in this 5 line dartpad.
enum Foo {A, B}
String myFunc(Foo f) {
switch(f) {
case Foo.A: return "A";
case Foo.B: return "B";
}
}