void f() {
String string;
setState(() {
string = fooCondition ? 'foo' : 'bar';
});
string.toUpperCase(); // Error
}
If I remove the setState
condition, the flow analysis work! I could put my setState
below (blank setState(() {}
) but that just reduce the readability of code. Is there any better way of doing it without making the string
nullable and checking for nullability thereafter?