Is it bad to keep only 1 state class for a Bloc?

Viewed 25

Take a todo app as an example. A typical State class might look like this: enter image description here

When I want to change the state a little, in response to an event, I will need to clone the current state instance, including the todo list. In some cases, for example a loading state, the presence of the todo list is not necessary at all, but the cloning happens anyway. When the todo list is large, will it be a waste of resource that I need to worry about?

I see the one-state-class method above in the flutter bloc example repo, but is creating a separate subclass for each state, like TodoOverviewInitial, TodoOverviewLoading, .etc the better way?

0 Answers
Related