In code reviews, I often see a construction like this:

enum Some { option1, option2 }

final someCondition = Some.option2;

void main() {
late final String x;

switch (someCondition) {
case Some.option1:
x = 'a';
break;
case Some.option2:
x = 'b';
break;
}

print(x);
}

Take a look at the…

Kirill Bubochkin

Head of Applications @ Mews

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store