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
11
votes
1 answer

Nesting BlocBuilders to Manage Multiple States on the same Widget

I wanted to nest the text Update BlocBuilder inside another BlocBuilder that controls its font size through a slider widget. But, I can't get it to work. Please help! BlocBuilder( builder: (context, state)…
Jonathan Daniels
  • 169
  • 1
  • 3
  • 10
10
votes
2 answers

How to dispatch Bloc events outside of Widget?

I'm new to Bloc architecture and I watched some tutorials lately. I have page which is StatelessWidget and inside I'm using BlocProvider to initialize Bloc inside my UI. It will return different widgets based on state changes. But even in tutorials…
martin1337
  • 2,384
  • 6
  • 38
  • 85
10
votes
4 answers

Flutter Bloc is not updating the state/ not working

I am developing a mobile application using Flutter. I am using the flutter bloc package, https://pub.dev/packages/flutter_bloc for managing and setting up the bloc. But when the state change it is not updating the widgets or views. I have a bloc…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
10
votes
2 answers

flutter_block: BlockProvider vs. RepositoryProvider

I want some clarification on BlocProvider and RepositoryProvider. From official API reference, they provide the same functionality - they provide an instance of an object to its descendant widgets. However, judging by the names, I guess BlocProvider…
Sevastyan Savanyuk
  • 5,797
  • 4
  • 22
  • 34
9
votes
6 answers

Unknown behavior with hot reload when using the go_router package

I was using go_router in a project. I had a separate file with an instance of GoRouter with all the routes (home, login, register). Then, I added authentication with a cubit. So I had to modify my GoRouter instance to a function that received with…
Miguel Yurivilca
  • 375
  • 5
  • 12
9
votes
8 answers

how to use flutter_bloc with go_router

I have built an app where I use flutter_bloc. i want to use go_router for navigation.but for dynamic routing how can i use GoRouter refreshListener parameter with flutter_bloc GoRouter( routes: [ GoRoute( path: '/', name: 'home', …
ismailfarisi
  • 249
  • 1
  • 2
  • 8
9
votes
1 answer

Flutter bloc state does not update state when updating List/array index

I'm trying to implement checkbox logic in bloc class. For that I create List checked in bloc class code is below. When CheckBoxClicked event trigger then for the first time state updated and I can see the box checked. class…
Abdullah Khan
  • 1,365
  • 15
  • 15
9
votes
1 answer

TabView does not preserve state when swiping from one tab to another

Context: Here's page that has a TabView to navigate between tabs all of these tabs are making use of flutter_bloc (version 6.0.1). Problem: When swiping to to any tab, the state is not being preserved and the entire widget tree is being rebuilt as…
Waleed Alrashed
  • 777
  • 1
  • 7
  • 20
8
votes
3 answers

Info: 'runZoned' is deprecated and shouldn't be used. This will be removed in v9.0.0. Use Bloc.Bloc.transformer instead

I am getting this issue while trying to run my code on DartPad. 'runZoned' is deprecated and shouldn't be used. This will be removed in v9.0.0. Use Bloc.Bloc.transformer instead... What is the correct way to replace it? code: import…
Sweta Jain
  • 3,248
  • 6
  • 30
  • 50
8
votes
1 answer

What is the difference between between context.watch and context.read in flutter_bloc?

I just learn about a cubit in a flutter. I learn in the tutorial video, so in that video, the mentor made a login page that contains an email and password text field and one login button. In that video, the mentor still uses the old version of…
8
votes
1 answer

Flutter could not find the correct Provider after navigating to different route

I'm using bloc to handle the state of a signup form. But I get the error: Error: Could not find the correct Provider above this BlocBuilder Widget. As you can see in the error I do use the bloc…
JonasLevin
  • 1,592
  • 1
  • 20
  • 50
8
votes
1 answer

When to actually close a bloc manually when using the flutter_bloc package?

I have recently watched felix Angelov's flutter_bloc package (https://pub.dev/packages/flutter_bloc) speech in youtube (https://www.youtube.com/watch?v=knMvKPKBzGE&t=3s) and it's amazing! I have a bit of confusion regarding closing the bloc manually…
Manas
  • 3,060
  • 4
  • 27
  • 55
8
votes
3 answers

Flutter Application Bloc listener not receiving state updates

I'm using flutter Bloc to navigate the user toward either the login page or home screen depending on whether they are authenticated or not. However, after the initial state change, the listener doesn't trigger when I change my authentication…
Niek
  • 187
  • 1
  • 8
8
votes
2 answers

The superclass 'Bloc' doesn't have a zero argument constructor in dart

I am a beginner in Dart language development. I try to create a sample flutter application BLOC pattern inspired by this GitHub repo, but I got some error message related to the class inheritance. I am already familiar with the inheritance and…
Ragesh P Raju
  • 3,879
  • 14
  • 101
  • 136
8
votes
2 answers

How to validate form when submit in flutter with flutter_bloc?

This is my change password screen. I was using flutter_bloc for implementing mvvc pattern. This page works fine with bloc. But what I am trying to achieve is validate form when submitting the form. As I was new to flutter I have no idea how to do…
Dheepak S
  • 207
  • 2
  • 5
  • 17
1
2
3
62 63