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
5
votes
4 answers

Flutter bloc listener not listening to state changes

I am using flutter_bloc library to create a verification code page. Here is what I tried to do. class PhonePage extends StatelessWidget { static Route route() { return MaterialPageRoute(builder: (_) => PhonePage()); } @override …
Merhawi Fissehaye
  • 2,482
  • 2
  • 25
  • 39
5
votes
2 answers

Flutter Bloc equatable state not updating with a Map of Strings property

My Bloc state isn't updating and I've found the problem to potentially be a Map property that isnt being compared properly. Please correct me if I'm wrong, but the state updates when the other properties change, just not…
Dustin Silk
  • 4,320
  • 5
  • 32
  • 48
5
votes
2 answers

Maintaining same state on different pages in flutter for a particular use case

I know there have been certain questions on state management in flutter, but none of them seemed to solve my use case. Recently I was building an app based on E-commerce and encountered this real need for state management. I had 2 pages, One is the…
5
votes
2 answers

MultiBlocProvider not instantiating all bloc providers - how to properly work with MultiBlocProvider?

I am using flutter_bloc and leveraging the MultiBlocProvider widget. Things were working fine, and then at some point, my MultiBlocProvider just refused to instantiate any new Blocs I created and added to it. I am pretty new to flutter_bloc so any…
danoch
  • 171
  • 1
  • 5
5
votes
3 answers

How to provide a BLoC (with flutter_bloc) to `showSearch`

I am using the package flutter_bloc for state management. I want to create a search screen, and found the showSearch Flutter function, and have been having issues providing a BLoC instance to the ListView my SearchDelegate implementation creates. I…
wujek
  • 10,112
  • 12
  • 52
  • 88
5
votes
2 answers

Bloc to Bloc Communication Mutibloc Provider

I'm using flutter_bloc and I need a bloc to communicate with another bloc - I have an activityBloc that needs to listen to the authBloc to determine if the author is authenticated and get the userid ( the intention is to start listening to document…
user3836415
  • 952
  • 1
  • 10
  • 25
5
votes
2 answers

Global dependency on flutter_bloc

I have a problem implementing an app on Flutter using flutter_bloc. I understood the core concepts but I found an "edge case" where there is not examples or guides (at least that I could find): (I will simplify the problem) I have a bloc called…
Ademir Villena Zevallos
  • 1,579
  • 1
  • 13
  • 20
5
votes
1 answer

Missing concrete implementation 'getter Equatable' / issue with props

I am working through many of the tutorials out there on bloc with flutter and running into some inconsistencies. I am using Android studio and creating the bloc code by using the plugin from Intellij v1.6.0. For the bloc_event, I continue to see…
bboursaw73
  • 1,128
  • 2
  • 13
  • 26
5
votes
2 answers

Listen to Events instead of States with Flutter BLOC

I am using the Flutter BLOC library (https://pub.dev/packages/bloc) I know there is a way to "listen to" BLOC states changes (with the listen() function) chatBloc.listen((chatState) async { if (chatState is ChatStateInitialized) { //…
Soms
  • 53
  • 1
  • 3
4
votes
1 answer

Initiate global bloc on Logout

I'm providing bloc at top of all view to access at globally. When I'm doing logout and re-login without closing app, event not called because it is already initiate. Here, I want to refresh bloc on logout, so that FetchList and UpdateCount events…
4
votes
1 answer

Undefined name 'HydratedBlocOverrides'

I am a Beginner in flutter and i was learning hydratedBloc, i imported all the needed dependencies as in the tutorial i was following and i run into a problem where my HydratedBlocOverrrides.runZoned is marked as an error [This is the screenshot…
4
votes
2 answers

Why use BloC or Provider in Flutter when we already have Flutter's built-in setState?

Maybe I don't understand the purpose of BloC or Provider but I'm confused as to why we would ever want to use them instead of using Flutter's built-in state management using the Stateful widget. I've just finished an app and can't remember a point…
boc
  • 158
  • 3
  • 11
4
votes
0 answers

Using flutter bloc emit.forEach with multiple streams

I am trying to use flutter_bloc with multiple streams from my location service and I need to accommodate multiple streams from the service to either emit a state or further get the data from other streams. Future _onGetLocation(GetLocation…
Abuzar Rasool
  • 79
  • 1
  • 9
4
votes
1 answer

Flutter bloc update item in list

product bloc class final ProductRepositoryImpl _productRepositoryImpl; ProductBloc(this._productRepositoryImpl) : super(ProductInitializing()) { on((event, emit) => _addToCart(event, emit)); on((event,…
avinash
  • 501
  • 2
  • 8
  • 16
4
votes
2 answers

Flutter BLoC : how to update state with null values?

How do you deal with "accepted null values" when you update a state in BLoC ? I use the flutter_bloc package. I have a form in which numeric variables are nullable so that I can check their validity before the form is submitted. But when I emit a…
Galactose
  • 175
  • 3
  • 8