Do I need to dispose cubit instances?


I am new to flutter and bloc. As a matter of fact, I have just recently started using cubit. For learning purposes, I have created a simple app in which I use cubit for bloc functionality. In all the examples I found online, they suggest disposing the bloc instance in the UI. However, I didn’t find something similar when it comes to cubit. So, my question is: Do I need to dispose the cubit instances and how? It worths mentioning here that I am using MultiBlocProvider.


Bloc extends Cubit and Cubit extends Stream. Like any Stream in Dart it needs to be disposed when it is not necessary, and it has close method to do so.
This method will be executed automatically if you are using BlocProvider

Answered By – Pavel Shastov

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *