Questions tagged [cubit]
153 questions
1
vote
1 answer
Can Blocs and Cubits be used Interchangeably?
I have been working with Blocs and I always navigate in the same way:
Navigator.of(context).push(MaterialPageRoute(builder: (_) {
return BlocProvider(
create: (context) => MovieListBloc(),
child: MovieListView(),
);
}))
And now, I'm…

spikeball
- 11
- 1
1
vote
0 answers
How to properly connect cubit and display air condition data from API in flutter
I have a problem, I'm creating an application where I want to display data from the air condition page, in this case it is "C6H6".
When I connected Cubita, the data is not displayed, even the data does not print in the terminal (i.e. the function is…

Grzegorz
- 11
- 2
1
vote
1 answer
How do I manage state size in Flutter Cubit architecture?
I have a screen that displays
a stock value of an asset
an asset selection dropdown
For now, I put all those values in a singe State class:
class AssetsLoaded extends AssetsState {
final List assets;
List get markets {
…

Alehar
- 639
- 5
- 16
1
vote
2 answers
Access the build context in a cubit (Flutter)
Main question
Hello! In Flutter I am using BLoC, and more specifically cubits, to manage the state of my app.
I have a few states in my weather_state.dart file:
WeatherInitial
WeatherLoading
WeatherLoaded
WeatherError
For the latter, I would like…

justAsking
- 11
- 3
1
vote
1 answer
The return type 'ListView' isn't a 'void', as required by the closure's context.dartreturn_of_invalid_type_from_closure
BlocBuilder(
builder: (context, state) {
if (state is RateFetchInitial) {
return const SpinKitFadingCircle(
color: Colors.grey,
size: 50.0,
…

MUHAMMAD SHAHID RAFI C P
- 1,067
- 1
- 12
- 25
1
vote
2 answers
how can i get length of list in widget
I can't get the length of the list in the widget although I wrote everything correct
this is my cubit
class AppCubit extends Cubit {
AppCubit() : super(NewsInit());
static AppCubit get(context) => BlocProvider.of(context);
…

Eslam Magdy
- 31
- 6
1
vote
1 answer
State in BLoC changes its value before calling emit(), but Equatable doesn't recognize the state change
My problem is that when I'm calling a Cubit function it changes a value before I hit emit. Because of that, the Cubit cannot detect that there was a change in the state and the emit() won't work.
I solved the problem by creating a random number each…

Salwan Arar
- 13
- 3
1
vote
1 answer
I want to add product to cart screen and show the total price and sub total and with cubit but it does not working
This is Product Models As Dummy Data
I can not show the price of product
import 'package:equatable/equatable.dart';
class ProductModels extends Equatable {
final String name;
final String category;
final String imageUrl;
final double…

Mohamed Alsiny
- 71
- 1
- 6
1
vote
1 answer
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(
…

Reza Taghizadeh
- 347
- 5
- 11
1
vote
3 answers
How can use AnimationController in Cubit or Bloc?
I want to use AnimationController in the StatelessWidget class with Cubit or Bloc in a flutter, if anyone can help me with an example link to explain?

Mohammad Mirshahbazi
- 793
- 9
- 22
1
vote
0 answers
Exception type null thrown from state for cubit
In the process of learning bloc and have started to create a basic state and cubit but I am now getting the following error.
I should be seeing a grey screen in emulation mode instead, I see the following red error.
_TypeError (type 'Null' is not a…

VanCoon
- 422
- 4
- 20
1
vote
0 answers
Cubit - listener does not catching the first state transition
I'm using a Cubit in my app and I'm struggling to understand one behavior.
I have a list of products and when I open the product detail screen I want to have a "blank" screen with a loading indicator until receiving the data to populate the layout,…

JACF
- 117
- 1
- 5
1
vote
2 answers
BlocBuilder vs BlocListener
I have a very specific question when reading the documentation.
After reading the BlocBuilder documentation, I then went on by reading about the BlocListener. Everything was pretty clear, until I read this:
The listener is guaranteed to only be…

Savvy
- 489
- 4
- 16
1
vote
0 answers
How to update list in Flutter BLoC
I can't update my list in Flutter BLoC
I have a list of 'Boards' that contain another list and my problem is when I change the value of done's a property in the checklist, It does not apply my changes
Even the board's properties won't change and the…

AmirJabbari
- 11
- 2
1
vote
1 answer
flutter_bloc is it ok to store a variable inside bloc/cubit class
i have a cubit named AuthCubit in which I have multiple functions related to authentication like login,resetPassword,...
the thing is all my functions need variable phoneNumber which is taken from user on on first screen, after checking if…

R3HP
- 470
- 4
- 13