I am using bloc architecture based this repo.
It seems that it is based a lot on type checking such as:
if (event is FooEvent) { // ... } //.. or if (state is BarState) { // ... }
Is type checking a good practice?
Are flutter & dart oriented towards this way coding or is this just a shortcut for this bloc implementation.
Hi @durduman 馃憢
Thanks for opening an issue!
Bloc does not have an opinion about how you model your events and states. In some cases, you can get away with using enums so you can simply switch on the event (see counter example).
In more complex cases, it's common to use classes to model your events and states. If you choose to go that route, you'll need a way to identify which type of event you are processing; type checking is one of the most easy/straightforward ways and there's nothing wrong with checking an object's type.
Hope that helps 馃憤
Thank you for your answer.
Most helpful comment
Thank you for your answer.