Questions tagged [flutter-cubit]

96 questions
1
vote
1 answer

hydrated cubit doesn't store state

In the following cubit, I tried to persist the state of the navigation of the application but when killing the app on the device and returning to the program it returns to the default state. How can I solve the problem? My cubit is: class…
zex_rectooor
  • 692
  • 7
  • 26
1
vote
1 answer

Issues initializing a Flutter cubit to automatically call a data loading function

I'm struggling to understand how to initialize a Flutter cubit such that it can load data automatically when it's first created. I saw 2 general recommendations during research, people say you can either call an initialization method in the cubit…
1
vote
1 answer

Flutter App Back button is closing the App instead of navigating to the previous screen in flutter Navigation 2.0 with bloc and cubit

I am working on a flutter App and managing state using bloc architecture and cubits for navigation. The App is a bit large and complicated. The issue I am having is when I tap the Android back button; it closes the App instead of poping to the…
wafutech
  • 481
  • 10
  • 30
1
vote
2 answers

Flutter BloC couldn't find correct provider when context.read is called

I created a basic project to learn Flutter better. In bnb.dart file if I use: context.read().selectedIndex to change the currentIndex field of the BottomNavigationBar. The application throws: The following…
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
1 answer

change Image assets depend on state changed with cubit (flutter)

I have 2 ImageAssets in my flutter project I want to switch between them depending on action, I am using cubit and states. the image changes after going to another widget and then coming back how can I refresh the widget or do this without a…
1
vote
1 answer

How to sync stream variable in BlocState with the TextFormField

I am not able to figure out the right architecture of getting this done using firestore streams and flutter_bloc. My goal : I have a logged in user and I want to store the user details in the collection with the document id same as logged in user id…
1
vote
0 answers

emitting of state doesn't seem to work the second time , flutter_bloc

I am working with flutter_bloc and trying to understand how it works entirely. I have Profile Screen. Where in the User should enter his details if previously not existed else should update the details. Logic: If the user already exists then i fill…
krishnaacharyaa
  • 14,953
  • 4
  • 49
  • 88
1
vote
0 answers

Flutter DropDownButton with Flutter Cubit

I am trying to figure out the optimal approach in creating a Flutter DropDownButton using Bloc/Cubit. I have a working solution but it is ugly. I have a Product Page with Category DropDown button. To populate the data, I am using BlocBuilder for…
NothingBox
  • 345
  • 5
  • 15
1
vote
1 answer

type 'Context' is not a subtype of type 'BuildContext'

can any one give me the solving for this error. i don't know when the error made and don't know what is the part of code that make this problem this is the error that shown when i run program ═══════ Exception caught by widgets library…
1
vote
1 answer

Why internet connection status is not listened in Cubit Constructor when running code in flutter web

I use from connectivity_plus for listening to internet connection and handling status with flutter cubit. when i run code on flutter web, status stay on NetLoading() untill once, i turn off(turn on) internet, but with run on android device not exist…
Hossein Asadi
  • 768
  • 1
  • 6
  • 15
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…
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
1
vote
1 answer

Flutter(Cubit and Repository) - Where to inject dependencies

I'm relatively new to Flutter and Cubit pattern and I'm trying to figure out which are the best ways to work with them. Recently my colleague and I have been struggling to reach an agreement where we should inject the cubit and the…
1
vote
1 answer

Flutter - Error in hot reload using lazy internationalization

I'm building an application that uses lazy internationalization, this way there will be no translation files in the application and all translations will be fetched from the internet when a new page is opened. For that I am using a localization…