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

Flutter - Flutter bloc state not updating

I'm using flutter_bloc library to manage the state of the widgets. I'm trying to update a variable in the state that is a List. When I capture the state and modify the desired value, then yield the new state, the state doesn't update, but the clone…
Diego Francisco
  • 1,650
  • 1
  • 17
  • 31
0
votes
1 answer

Flutter show Snackbar inside build

I implemented the BLoC pattern in my app by I have a problem. Once I have a special event, I need to show a snackbar, but I have this error : The following assertion was thrown building InteractWithMorceauPage(dirty, dependencies: [MediaQuery],…
0
votes
0 answers

Stream subscription is not listening to changes in flutter

I m trying to fetch Firestore documents in BLoC pattern. There are two events, one fetches all the documents, the other fetches documents based on a query. Here is the code for the two events: Stream _mapFetchAllJobPostsToState( …
Newaj
  • 3,992
  • 4
  • 32
  • 50
0
votes
1 answer

Flutter returns "No ancestor could be found starting from the context that was passed to I/flutter"

I cannot figure out what is wrong with this code. There is a bloc provider on this page: Widget build(BuildContext context) { return MultiBlocProvider( providers: [ BlocProvider( create: (BuildContext context) { return…
0
votes
1 answer

How can I apply flutter_bloc in my project?

I am using this package: flutter_bloc for my project. But I have a problem when my home screen has 2 widgets. 1 widget to display news most views of the day, 1 widget displays the news that is suitable for each user object. Each of these cases calls…
Doan Bui
  • 3,572
  • 25
  • 36
0
votes
1 answer

Drawer navigiation load content with BLoC

I'm trying to load content or page from my drawer with BLoC. I'm using flutter_bloc: ^4.0.0 MenuBloc class MenuBloc extends Bloc { @override MenuState get initialState => Dashboard(); @override Stream
Boby
  • 1,131
  • 3
  • 20
  • 52
0
votes
1 answer

Caculate the total task created on firebase base on id flutter

I would like to calculate the total created task on firebase using flutter. Is there a way to do it using flutter do I have to use java and swift to do this function. This is how I stored my task and they are generated by firebase (ID). Done it in…
Duxton Lim
  • 21
  • 6
0
votes
0 answers

Bloc gives null value when controlling multiple states

I wrapped my root widget with BlocProvider and used BlocBuilder to draw my widgets according to states of ScreensControllerBloc and used BlocProvider.of(context).add(....) to change states of bloc and the first state which is ScreenIndexState is…
0
votes
1 answer

what is the right way to provide a bloc?

hi guys i m new in flutter and my question is what is the right way to provide a bloc? i decided to provide theme in main file in named rout section but the problem is when i need a bloc inside of other bloc i cant provide it. here is my main file…
reza47
  • 650
  • 6
  • 16
0
votes
1 answer

How to load data in the body property using flutter + (bloc) Pattern

Hello friends, I have been learning to use flutter for weeks, I am creating an app that I develop as I learn to program in flutter. My idea is to be able to follow the Pattern (BLoC). What I want to do now is like being able to load the movie data…
Chris Michael
  • 1,557
  • 3
  • 15
  • 23
0
votes
1 answer

Why is the BlocBuilder never called when bloc is not set explicitly

This is an example of a Flutter counter app. I instantiate the Counter with a Bloc like this: class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', home:…
N'joy Y'ventr
  • 172
  • 2
  • 9
0
votes
2 answers

flutter_bloc 4.0.0 how to get event properties/parametrs

I am quite new to this library and BLOC pattern too, I need fetch all products and a single product based on a particular id. I have seen many examples created using this library , those people are getting parameter by event.paramter In my case its…
techieasif
  • 153
  • 2
  • 9
0
votes
1 answer

how to navigate to other page from streambuilder in flutter?

i am trying to implement login functionality using bloc pattern in flutter. So I want to navigate to main page after authentication is successful. from loginBloc.dart I will get the status inside the streamBuilder in login.dart when the status is…
Suhail Ahmed
  • 157
  • 2
  • 15
0
votes
1 answer

Flutter bloc update object state after async finish

I'm working with flutter and the bloc pattern. The Todo tutorial (https://bloclibrary.dev/#/fluttertodostutorial?id=bloc) explains the bloc very well. But no I want to extend the example app with information about "object sync completed/running".…
Dominik00000
  • 311
  • 1
  • 3
  • 10
0
votes
0 answers

What is the best way to provide blocs using flutter_bloc package

I'm using flutter_bloc package to create an app to fetch data from API, my blocs are so many and I'm providing them to the whole app from the very beginning before even creating the material app like this: return MultiBlocProvider( …
Wail Hayaly
  • 1,057
  • 1
  • 15
  • 31