Questions tagged [flutter-bloc]

For questions relating to the "flutter_bloc" package for the Flutter framework. Use this tag in combination with the general [flutter] tag. If your question applies to Flutter more generally, use the [flutter] tag only.

This tag should be used for any questions regarding the flutter_bloc package for the Flutter framework.

flutter_bloc is a package implementing the BloC pattern for Flutter, specifically the BlocProvider and BlocBuilder classes.

To get started, you can read through the README document on GitHub.

932 questions
0
votes
1 answer

Child bloc calling its ancestor mapEventToState

I'm trying to create a CustomBloc that handles common events. CustomBloc is extended by many other Blocs to add functionality. My problem is the call of super.mapEventToState in CustomBloc descendants never gets executed. class CustomBloc extends…
0
votes
1 answer

GetX microservice with FloatingActionButton + What's a good choice? GetX or Flutter BLoC?

Anyone here have used GetX Dialog Component inside of FloatingActionButton (FAB) in Flutter? i have tried it. but, i still got error when implemented in build debug. can you have to give me a good choice. what's a good choic GetX or Flutter BLoC?…
Michael Fernando
  • 117
  • 1
  • 10
0
votes
1 answer

How do I change the state using mapEventToState?

This is the first time I'm working with a BLoC and I don't understand how to change states. I have a TextFormField and a Button and I want the Button to save the controller to the User class property I need. I understand how to give to the stream…
steind.VY
  • 333
  • 2
  • 11
0
votes
1 answer

Flutter Bloc Rx dart combineLatest2 combine function not running

I'm writing a flutter app and and using the bloc library. I have a bloc and a cubit, within the state of each is a list of ids of some other documents I need to fetch from firestore. There can be some overlap and some docs are already fetched so I…
0
votes
1 answer

How to pass same widget to all states in a blocs builder

Let's suppose i have the following bloc builder: return BlocListener(listener: (context, state) { if (state is ErrorLoginState) { showError(state.message, context); } }, child: BlocBuilder( …
0
votes
1 answer

Lazy instantiate blocks with BlocProvider.value

I'm using Generated Routes with Flutter, and I would like to share blocs between them. But I think that maybe the example solution might not scale the best, since the blocs are instantiated with the router. Is there a way to instantiate them only…
Enzo Dtz
  • 361
  • 1
  • 16
0
votes
2 answers

When I use Bloc pattern My infinite list doesn't scroll

I want to make infinite list with bloc pattern but My bloc builder works only 1 time.After scroll the page "yield" doesn't work so bloc builder doesn't build.The new items comes but state doesn't build. deliveries_bloc.dart: import…
Gorkem
  • 19
  • 3
0
votes
1 answer

Flutter, a little Cubit BlocBuilder problem

I've trying to show my int state of Cubit using BlockBuilder, that's my code: class CounterCubit extends Cubit { CounterCubit() : super(0); void increment() => emit(state + 1); void decrement() => emit(state - 1); } class…
0
votes
1 answer

Flutter - Could not find the correct Provider above this ChangeLocation Widget

I'm using both BlocProvider & ChangeNotifierProvider in my app. The flow of the app goes here:- first time user opens the app: InstructionPage() -> WelcomePage() -> HomePage() //getting error second time user opens the app: HomePage() //working…
0
votes
1 answer

Flutter Bloc: Return custom constructor object as the state

I have created a model for users details which will be returned after a post request. Model: class Did { String message; bool success; String id; String docHash; String pubKey; String privKey; Object credential; …
JonasLevin
  • 1,592
  • 1
  • 20
  • 50
0
votes
1 answer

Bloc State is yielded but UI is not updating

I'm having an issue using bloc. The bloc state is updating but it seems to be no effect on UI. I have reproduced the issue using an example app. The issue is removing an item from the list page does not change is color back to deselected state.…
Shivam Singh
  • 87
  • 2
  • 11
0
votes
2 answers

Flutter: simple_bloc_observer.onError

Anytime I try to run the following code, it fails to compile, the error is in line 17 of the code, it is in the onError string that is right after Future, looking forward to your response. import 'package:flutter_bloc/flutter_bloc.dart'; class…
0
votes
1 answer

flutter_bloc could not find the correct provider

I have a Cubit that fetches data from an API. I want to connect that to the UI so I added a BlocProvider on top of that widget at first. That gave me an error, so I wrapped the MaterialApp with the BlocProvider which gave the same error. After that,…
IncorrectMouse
  • 179
  • 1
  • 9
0
votes
1 answer

How do I integrate flutter_bloc with method channels?

I've started using flutter_bloc package instead of redux to try it out, but I'm not entirely sure how I'm going to call flutter bloc events when receiving things from native (Android/iOS). It was easier with redux because in my parent MyApp widget…
Johnny Boy
  • 790
  • 3
  • 7
  • 18
0
votes
1 answer

trigger and wait for item creation in different BLoC

My approach below feels way to complicated for a simple thing I am trying to achive: I have a list of Tasks that is managed by a TaskBloc. The UI lists all tasks and provides an execute button per task. For each click on that button I want to create…
Stuck
  • 11,225
  • 11
  • 59
  • 104