flutter_bloc. Automatically disposes cubit/bloc when used directly in BlocBuilder

Viewed 86

Does the code below automatically disposes the directly called instance (cubit in this case) if I called this directly.

BlocBuilder<TestCubit,TestState>(
  cubit: TestCubit(), // Direct call of cubit instance
  builder: (context,state){
     ....
  }

I'm wondering if the BlocBuilder will handle this directly. I don't need to use BlocProvider in this cubit/bloc neither want to use StatefulWidget just to call dispose method.

I have tried reading the flutter_bloc code implementations and its web documentation but I struggle to find an answer (or might just have missed it).

Hoping someone would enlighten me with this.

0 Answers
Related