State management with setState and bloc

Is it good to use bloc and also setState for state management?
Basically, I’m using bloc to control the state when I need to share the state when others classes (screens), but I’m using setState inside reusable components like a text field, where I control the error messages, the obscure text, etc. Which I consider does not have to be inside the business logic as well.
So I was wondering if this is a good practice or not.

Thanks!!!

1 Like

Yes it definitely is and one of the more popular practices of state management!

I would also suggest that you try to reduce the use of setState as you should keep your logic separate from the UI to increase reusability of your components and modularity of the code.

1 Like