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 bloc yield per item from own stream

hope you're all are doing well and #stayhome and keep #socialdistancing :) I do have a small problem with the flutter_bloc library and I'm hoping that someone can help me out. I have an API-Call (moviesStream), which returns a stream. What I would…
0
votes
1 answer

How to use flutter_bloc to change the UI when the state is the same but the state content is different

I'm using a BlocBuilder from the flutter_bloc package to respond to state changes. @override Widget build(BuildContext context) { return BlocBuilder( builder: (context, state) { if (state…
pilipinoy
  • 151
  • 8
0
votes
1 answer

Flutter Bloc conflicting states

I'm trying to build a login activity using Bloc, with the help of the tutorials available at https://bloclibrary.dev/. I've successfully combined the Form Validation and Login Flow into a working solution, but things took a messy turn when adding a…
PM4
  • 624
  • 1
  • 5
  • 18
0
votes
0 answers

Streambuilder not getting called inside dialog box in flutter

I am using below code. I click some button and if my OTP match below method is getting called. and in that method i am calling bloc. Widget i am using is Statefulwidget. void matchOtp() { showDialog( context: context, builder:…
ios developer
  • 3,363
  • 3
  • 51
  • 111
0
votes
1 answer

BlocBuilder is not updating on state change

I'm trying to implement a player using a BLOC pattern. When I change the state in the mapEventToState() method the BlocBulder() widget is not updating as expected. This is the PlayerBloc:- class PlayerBloc extends Bloc { …
Sudeep Bashistha
  • 1,320
  • 12
  • 16
0
votes
1 answer

Flutter Bloc is not rebuilding state

I have implement a this simple bloc with the flutter_bloc package: class MainBloc extends Bloc { @override MainState get initialState => Init(); @override Stream mapEventToState(MainEvent event) async* { …
Dix20
  • 178
  • 2
  • 8
0
votes
1 answer

Flutter MultiBlocProvider Performance

I have a MultiBlocProvider assigned for an app that has a Bottom Navigation Bar to navigate through main routes like Home, Search, Wishlist ... I use setState(){} to change the currentPage for each route. Recently I've added Blocs to each of them by…
Wail Hayaly
  • 1,057
  • 1
  • 15
  • 31
0
votes
0 answers

Flutter Bloc & Firebase Image architecture

I'm busy with my first flutter app and have a question as to how set up the architecture to properly manage images/media within the application. I'm using the flutter bloc todos example as a starting point. My question is how do I mange images…
TM00
  • 1,330
  • 1
  • 14
  • 26
0
votes
1 answer

Trigger a bloc event during a state change to open a modal

Is it a good practice (or at least possible) to trigger an event during a state change in flutter with flutter_bloc? As in: if (state is SomeState) { _bloc.add(Event()) } My use case in this scenario is to trigger a modal as reaction to some…
Jorge Lima
  • 157
  • 15
0
votes
1 answer

How to update the countdown timer repeatedly in flutter

SCENARIO In this app there is a countdown timer, whenever I open the app the countdown timer starts at 5 automatically and stops at 0. QUESTION How do I update/change the timer number when it reaches 0 and automatically goes back to 5 and start…
mohammed nabil
  • 475
  • 2
  • 14
  • 27
0
votes
0 answers

Flutter BLoc : Architecting a series of Flutter pages/routes and saving state

My flutter app has a series of pages which collect data (a series of forms). Every time the user enters data and goes to the next screen, the data is stored in my remote database. The user should have the ability to go back and change the data he…
sharath
  • 3,501
  • 9
  • 47
  • 72
0
votes
2 answers

Dart model throws error when mixing many data types

I made this simple model to work with an API class BooksModel { List<_Book> _books = []; BooksModel.fromJson(Map parsedJson) { List<_Book> temp = []; for (int i = 0; i < parsedJson['books'].length; i++) { _Book…
ler
  • 1,466
  • 3
  • 20
  • 37
0
votes
0 answers

Is there any side effect for using a global top level variable when we are running tests in parallel?

I am here for clarification about unit tests in Flutter. Here is a typical test snippet that I use to test my flutter_bloc bloc component. void main() { TestWidgetsFlutterBinding.ensureInitialized(); ///we have only one data repository which is…
Code Wizard
  • 319
  • 3
  • 8
0
votes
1 answer

Flutter Bloc - Widget tree growing endlessy

When I'm going back from the final view to my "initial view" every State of all 3 BlocProviders is being saved. See Widget tree: My Code is linked here: GIST I don't understand what I am missing, on first run everything works fine. However, when I…
0x45
  • 779
  • 3
  • 7
  • 26
0
votes
0 answers

NoSuchMethodError: The getter 'bloc' was called on null

I'm a beginner in Flutter and BLOC, i have a problem when trying to fetch Country List data. Error was NoSuchMethodError: The getter 'bloc' was called on null. below was my code. I'm just follow this tutorial…