Questions tagged [flutter-cubit]

96 questions
0
votes
0 answers

CUBIT Unhandled Exception: Bad state: Cannot emit new states after calling close

i'm learning to use Cubit, Initially the application runs without any errors when I do the likeArticle, but when I do the like method continuously or too often an Unhandled Exception will occur. This my code: //article_cubit.dart class ArticleCubit…
0
votes
0 answers

Flutter Cubit State Design for Navigation

Good day everyone! Let's imagine I am using Flutter Cubit with @freezed for an authentication screen. There are several ways on how to structure the state but all come with a problem I can't find a way around. I normally design my States like…
0
votes
0 answers

How to add watch to state variable from separate cubit?

I am new to flutter and trying to add a watch on a variable of a state. Now from some FavoriteScreen cubit, if I had to watch this variable 'someKindOfList' which is present in ExploreLoaded state. How would I do it? I tried the following: class…
Biswas Khayargoli
  • 976
  • 1
  • 11
  • 29
0
votes
1 answer

How to alter state of one screen from another screen using Cubit in Flutter?

I am new to flutter and I am using the Cubit from flutter_bloc package. I have this situation going here. I have screen-A as in diagram below where I show list of videos and the likes, comments connected with this video. Now I have screen-B (some…
Biswas Khayargoli
  • 976
  • 1
  • 11
  • 29
0
votes
2 answers

RangeError (index): Invalid value: Only valid value is 0: 4 when trying to add to cart

ElevatedButton( style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10))), onPressed: () { cubit.addItemToCart( id:…
Khaled
  • 15
  • 3
0
votes
0 answers

Flutter Cubit not updating state

Cubit State class class AuthState extends Equatable { const AuthState({ this.makePwdVisible = true, }); final bool makePwdVisible; @override List get props => [makePwdVisible]; AuthState copyWith({ bool?…
0
votes
0 answers

How to get data from List to string Text String

`I have a problem how to call data from a list, and extract values from it inside a text' Widget build(BuildContext context) { return BlocProvider( create: (context) => AppCubit()..getBusiness(), child: BlocConsumer
0
votes
2 answers

Cubit state change problem in flutter cubit

So I am trying cubit state management and through that I am trying to login a user to second screen. The error occurs in cubit states changing as it's stuck on initial State. Upon pressing the login button the cubit functions are called for…
Aditya Pandey
  • 355
  • 1
  • 5
  • 12
0
votes
2 answers

Flutter Bloc-Cubit Retain details from other states

I have below CategoryState in my project: part of 'categories_cubit.dart'; abstract class CategoriesState {} class CategoriesInitial extends CategoriesState {} class CategoriesLoaded extends CategoriesState { final List categories; …
NothingBox
  • 345
  • 5
  • 15
0
votes
1 answer

Flutter BlocTest with KeyEvents

I want to simulate a key event press using blocTest for a Cubit function I'm testing. So far it doesn't seem like I can call simulateKeyDownEvent within BlocTest because it focuses on the Bloc/Cubit and not the widget. But when I mock a…
David
  • 103
  • 1
  • 1
  • 8
0
votes
1 answer

Flutter Application Stop Responsing and should kill the app and run again to work after call Random Functions in App

My problem only happen while im trying to use the app and click on buttons to on screen.. The application does not stop responding when I click on a specific one, what happens and this happens randomly, I do not know why And Also Android Studio…
0
votes
1 answer

Unable to print value from async and await

I am trying to print and return value outside stream block using async and await but i am not able to print it outside. Please help. Here is the below code getMarkets() async { //IOWebSocketChannel.connect('wsxxxxx'); var response; var…
md gouse
  • 527
  • 1
  • 6
  • 22
0
votes
1 answer

Flutter: Stream data from rest api using Cubit

The idea is to fetch data from api continuously and show this data in screen, without need to fetch manually, like that if someone else perform a change on server data this change will be shown without user refreshing action. The implementation is…
abdello
  • 158
  • 3
  • 13
0
votes
1 answer

Flutter multi bloc provider using cubit

I have a screen where there is a list populating items, now I want to add dropdown list above the list, so I am confused on how to implement it. Following is a code snippet: body: BlocProvider( create: (_) => HomeCubit()..fetchUsers(), …
angelina
  • 59
  • 2
  • 11
0
votes
2 answers

BlocProvider.of() called with a context that does not contain a RegisterCubit

the error show up when I try to create a new user, registr page worked yesterday and I have not changed anything on it. Can you help me? Here is my code register cubit class RegisterCubit extends Cubit { RegisterCubit() :…
Mus
  • 67
  • 1
  • 13