This may sound naive but I wanted to know if we explicitly need to call the dispose method while working with blocs ? So usually I do something like this :
- Create a bloc provider
- Define the bloc class and initialise the behaviour/publish subjects
- Create a dispose method where we close the streams.
Now, the question is that do we need to explicitly call this dispose method somewhere ? Or does bloc providers automatically do it for us ??
Your help shall be highly appreciated. Thank you.
You can use my lib: https://pub.dev/packages/flutter_bloc_pattern, which provides
BaseBloc
,DisposeCallbackBaseBloc
,RxStreamBuilder
Example