Open
Description
If a nullable variable is used in the switch()
clause of a switch
statement, it should be promoted to non-nullable for any clauses in which the matchers are all non-nullable. For example:
int foo(int? value) {
switch (value) {
case 1:
case 2:
case 3:
return value;
default:
return 0;
}
}
This currently produces the following analysis error:
error • A value of type 'int?' can't be returned from the function 'foo' because it has a return type of 'int'. • test.dart:7:14 • return_of_invalid_type