Questions tagged [flutter-cubit]
96 questions
1
vote
3 answers
How to access a variable present in state in cubit in flutter?
I am using cubit for state management in my app. I have a variable in the state called prices which I want to access:
Future fetchMonthlyTotals(String userId) async {
//var userId = await getUserId();
var prices =
await…

Aditya Dixit
- 255
- 2
- 12
1
vote
0 answers
Flutter Cubit Listener Listview data not refreshing when button pressed?
I have two listviews one is horizontal the other is vertical when I click on the horizontal listview button to fetch the data from API and update the value in the vertical listview.
Here API call is happening but values not updating in listview and…

kumar
- 111
- 12
1
vote
0 answers
Flutter Google Map Markers are shown only after hot reload - using with cubit and custom marker
I'm struggling second day on this issue.
I use flutter google map to show about hundred custom markers with network image icons, that can be svg or png (using MarkerGenerator).
After opening the map page, MapCubit start to load items from API. In…

Jakub Rony Roncak
- 33
- 4
1
vote
3 answers
'Null' is not a subtype of type 'Stream' in type cast cubit(Bloc) flutter
I have created a cubit testing project in flutter which is working fine, but when I am writing a UI test case with mockito for the same it is throwing the following error.
'Null' is not a subtype of type 'Stream' in typecast. If the real object is…

Anand Kumar Jha
- 614
- 9
- 23
1
vote
0 answers
Use AnimatedSwitcher with Widget depending on Cubit?
I'm currently struggling on using an AnimatedSwitcher combined with Cubit.
Here is my current code-part:
@override
Widget build(BuildContext context) {
return BlocBuilder(
builder: (context, state) {
…

kalinor
- 159
- 1
- 11
1
vote
2 answers
Using multiple BlocBuilder of same Bloc/Cubit, each for different events
Like this below official code sample, I used two BlocBuilder of CounterCubit for two different events increment and decrement.
It's running without any error, but both BlocBuilders are calling on each event.
I want one Builder should call on…

Deven
- 3,078
- 1
- 32
- 34
1
vote
1 answer
How to integrate data retrieved from an API via Timer.periodic into Flutter Cubit project
I am working on a Flutter Bloc/Cubit based application in which I will need to have a Timer.periodic running that will retrieve data from an API at a certain repeating duration and then update the UI if new data is retrieved.
I'm confused as to the…

MBU
- 401
- 5
- 16
1
vote
0 answers
BlocListener does not listen from Current screen
I am new to Flutter and using Block for state management. I have two screens
RegistrationScreen
VerifyScreen
In 'RegistrationScreen' I have added my BlockConsumer as below
child: Center(
child: Column(
children: [
…

Gagan_iOS
- 3,638
- 3
- 32
- 51
0
votes
2 answers
Multi Bloc Provider Flutter
I have several cubits working in my application, but for the cubit to work it always needs to be injected into the MyApp Main of my application, is there any way to concentrate the Cubit / Bloc instances without having to fill the APP with code?
…

geovane
- 1
- 1
0
votes
0 answers
Flutter feature-based architecture with Cubit
For a personal project of mine, I have chosen to use a feature-based architecture and implement Flutter Cubit for state management. So I would have feature folders that contain presentation, domain and data layers. Since I will have multiple pages…

Mihail Iliev
- 163
- 1
- 8
0
votes
1 answer
How to use Cubit when working with the form?
I have a feedback screen.
The themes for this form are loaded with a separate query.
I understand correctly that when using any state manager, in this case Cubit I have to give up setState() and create 3 Cubit:
Cubit to get a list of themes…

Hot January
- 1
- 1
0
votes
1 answer
Value Not Updating in BlocBuilder and Bloc Consumer
I have list in my HomeScreenState i want to update list item based on index but it is not updating on UI instalnstaly i have to rebuild the state in order to see the change, i try using BlocConsumer and BlocBuilder but none work for me.
This is my…

Ahmad Raza
- 758
- 7
- 26
0
votes
1 answer
How to I handle UI async processes with a Bloc StreamSubscription?
So I have a flutter app which uses Bloc pattern. I'm still kind of new with how Blocs works compared to Cubits. But I get the general idea (events vs functions).
The problem is with an async process in the login flow, I'm unable to make my View wait…

Retrosec6
- 169
- 11
0
votes
1 answer
Flutter Late variable throwing LateInitializationError even after assigning a value in a function in class
I am doing phone authentication using firebase in flutter and I have defined a late variable called verification id so that when the otp is sent it is initialized by it's value and i can use it later, but it is always null why is that?
This is my…

Mustafa Adel
- 51
- 5
0
votes
1 answer
Handle inheritance with Cubit
I have one common state where I need to handle multiple states like the Loading state and Error state.
All other states should have access to both states. So I can re-use these states to base screen and handle those states at single place.
Below is…

VAB
- 1