Questions tagged [cubit]
153 questions
0
votes
0 answers
Bloc builder not printing current state in flutter
I am working on a flutter project where i am calling an Api using bloc provider and emiting a state if i got the output.When i printed the output in cubit its working and after emiting that output i cant get it in bloc builder, even the state is…

Akash
- 89
- 13
0
votes
1 answer
To read from one State to Another in flutter_bloc
I have been working on an app, here the basic structure looks like.
Having a MultiblocProvider. With two routes.
Route generateRoute(RouteSettings routeSettings) {
switch (routeSettings.name) {
case BASE_ROUTE:
return…

Alpit Anand
- 1,213
- 3
- 21
- 37
0
votes
1 answer
Cubit not emitting state
Folks, I need some help with this.
I have this code
void onLoad(int id) async {
final result = await ListRepository.loadProduct(id);
if (result != null) {
product = result;
WoocommerceModel? model = product!.woo;
if…

fplopez
- 1
- 4
0
votes
1 answer
Why is flutter bloc v8 closing a globally created cubit when I pop some screen that was using this cubit
it gives me this error:
Unhandled Exception: Bad state: Cannot add new events after calling close.
0
votes
1 answer
Flutter Error : Could not find the correct Provider> above this BlocBuilder
I'm trying to implements a Cubit that is used to make the navigation bewteen the pages.
My first try was to implement it on my background screens, but I got this error when trying to do it :
"Error: Could not find the correct…

Zouglou
- 89
- 1
- 11
0
votes
0 answers
flutter cubits display data on a DataTable depending on the data from other DataTables
I'm new to flutter, flutter_bloc library particularly with cubits.
I'm trying to populate dynamic data from 3 different api calls to DataTables using cubits.
The pattern is as follows:
Gather the parameters needed for 2nd table from 1st Table,…

leipzy
- 11,676
- 6
- 19
- 24
0
votes
1 answer
Flutter BlocProvider value something wrong
I new a bloc/cubit pattern, before I used provider, getx and I want to ask something.
This application have nearly 40 pages and I want to use bloc just 10 pages and close bloc instance when is last page is closed.
Example page 1, I initialize bloc,…

Said Kurt
- 104
- 7
0
votes
1 answer
is Flutter bloc always must have one property(data)
I am worker for a project on flutter with bloc as state management.
But my screen contain a wide variety of data.
How can I management all this data?
class ProductCubit extends Cubit {
Worker worker = Worker();
…

Yassine Bouhroz
- 3
- 3
0
votes
2 answers
Problem while using floating action button in Bloc
I am trying to implement a dynamic list view in flutter which could be increased by tapping the floating actin button. But the method in onPressed of floating action button is being updated only once.
Below is my code for both the UI and flutter…

Ankit Kumar Maurya
- 991
- 7
- 20
0
votes
2 answers
How to increment a counter from another route/page in Flutter
I'm using Bloc/Cubit (flutter_bloc) & Auto_Router packages
I have the counter on the /counter route and FloatingActionButtons on a /user_profile route to increment the counter.
How can I increment the counter from a different page/route? I should be…

user433575
- 357
- 1
- 4
- 13
0
votes
1 answer
When Using "BlocBuilder" in "MultiBlocProvider" I have get error
I am new in flutter .I am tried googling but I cant fix my problem. I used "MultiBlocProvider" for manage stats . I want change dark mode state like bellow.
ThemeCubit.dart
part 'theme_state.dart';
class ThemeCubit extends HydratedCubit…

zeynab farzaneh
- 529
- 4
- 20
0
votes
1 answer
Flutter State Management with Bloc/Cubit
for many of you this is an obvious / stupid question, but I've come to a point where I don't have a clue anymore. I have real difficulties understanding State Management with Bloc / Cubit.
Expectation: I have a page with a ListView (recipe_list) of…

paswes
- 51
- 2
- 10
0
votes
1 answer
Flutter Bloc (Cubit) Managing Multiple Different States on One Page
How to follow the path for multiple states on a screen in bloc(cubit) state management with Flutter?
First widget on my home screen is DropdownButton for cities, second Widget is CarouselSlider for announcements. Should I create a separate Cubit…

Gurkan T
- 198
- 2
- 14
0
votes
2 answers
throw providernotfoundexception(t, context.widget.runtimetype);
I'm learning flutter and decided to work on a todo list application using cubit. I am created a cubit using bloc provider in the homescreen and in another screen I'm trying to consume the same cubit directly without creating another one.
Homescreen…

Ammar Montaser
- 51
- 8
0
votes
1 answer
TypeError: Cannot read properties of null (reading 'getAllPostsRep') bloc cubit flutter
i'm new in bloc, i have static data and need to write clean code using data layer "repositry and model"
before write this line in initstate, the Loading widget was only work
but i discover that i should write cubit dunction in the initstate to emit…

Michael Nabil
- 15
- 1
- 5