Is your feature request related to a problem? Please describe.
I'm learning to use bloc flutter step by step and type code while reading Timer Tutorial.
Unfortunately, I've made a typo in timer_bloc.dart -> _mapResumeToState,
on which: if (state is Paused) - typo as: if (state is Pause)
This makes resume not work as expected. I admit this is failed by me and it's rare to had this typo, but it does happened :(
Describe the solution you'd like
I didn't find this typo when checking my code until do a diff onto sample code, finally finding it types as 'Pause' instead of 'Paused' (In my mind, when checking my code it is in 'Pause' state and it's right, there is no typo here, lol)
For further testing, this if-condition accept any class/enum object.
This tiny typo is really hard to notice, without obvious warning by IDE.
Describe alternatives you've considered
Is there a better approach to check state, with strong type-checking mechanism?
For example, when using switch-case for enum, Android Studio will warn about "Missing case clause for 'enum_elem'"

Additional context
Further thought, by naming state/event with prefix State, such as StatePaused, EventPause could nearly eliminate all typos like this. But it seems too verbose and trivia.
Duplicate of #482
Is there a way to use switch-case approach for complex cases?
Hey @imckl 馃憢
Thanks for opening an issue!
Unfortunately, dart doesn鈥檛 natively support sealed classes (yet) but you can take a look at sealed_flutter_bloc and the sealed_flutter_bloc_samples for one way to solve this currently.
The code you鈥檙e probably interested in is:
https://github.com/felangel/sealed_flutter_bloc_samples/blob/cd5d24c02a08b525bdc84b9b35b9feebf9a524f9/sealed_flutter_infinite_list/lib/bloc/post_bloc.dart#L33
Hope that helps 馃憤
Thanks! I'll walk through to the sample code.
Most helpful comment
Thanks! I'll walk through to the sample code.