Reza Taghizadeh
Reza Taghizadeh

Reputation: 487

preventing a cubit or bloc to close automatically

I use the below code because I didn't want to use a new cubit in my dialogue I needed exactly the same that I used on my page.

Utility.showBottomNavigationMessage(
                      context,
                      MultiBlocProvider(
                        providers: [
                          BlocProvider<SubCategoryCubit>(
                            create: (context) => _subCategoryCubit,
                          ),
                          BlocProvider(
                            create: (context) => _insertFinanceCubit,
                          ),
                        ],
                        child: const SubCategorySelector(),
                      ),
                      Languages.of(context).subCategoryTitle,);

Although the dialogue works in a true way, It has a very bad bug. when I close the dialogue, these cubits closed too. but I don't want it and I try to find a way to prevent cubits from closing but I couldn't. could you please help me?

Upvotes: 1

Views: 989

Answers (1)

Reza Taghizadeh
Reza Taghizadeh

Reputation: 487

I solve it easily.

 MultiBlocProvider(
                          providers: [
                            BlocProvider.value(
                              value: _subCategoryCubit,
                            ),
                            BlocProvider.value(
                              value: _insertFinanceCubit,
                            ),
                          ],
                          child: const SubCategorySelector(),
                        ),
    ),

Upvotes: 1

Related Questions