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
2 answers

How do you do Rx.CombineLatestStream using the flutter_bloc package

I put together a sample app that implements an username and password field using streams with verification using validation transforms. I used RxDart for this and I hooked up the "Login" button to enable/disable based on 2 streams results being…
JustLearningAgain
  • 2,227
  • 4
  • 34
  • 50
0
votes
1 answer

Avoid Bloc state-sharing with multiple Widget instances in Flutter

Good day everyone, I'm using Flutter with bloc and I'm trying to show a list of Channels which you can "Follow" o "Unfollow". I have a custom ChannelContainer Widget that loads a list with channel titles and a custom widget JoinButton which shows…
Juli15
  • 411
  • 7
  • 17
0
votes
0 answers

Exception caught by widgets library ═ Stack Overflow why this only shows when I initializing bloc

class _GridViewContentState extends State { final likeBloc= LikeBloc(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), while i…
A.K.J.94
  • 492
  • 6
  • 14
0
votes
1 answer

Flutter Bloc with news api

I am stacked!! and i know i will find help here . I create a flutter application which fetches data from news.org API . Everything was working fine until i started implementing BLOC in the app . I have successfully implemented the first part with…
0
votes
1 answer

'BlocProvider' can't be returned from method 'build'

error: A value of type 'BlocProvider' can't be returned from method 'build' because it has a return type of 'Widget'. (return_of_invalid_type at [new_app] lib\src\counter_screen.dart:8) Using bloc: ^6.1.0 , flutter_bloc: ^6.1.1 [enter image…
0
votes
1 answer

Flutter Bloc Library

In an application I am trying to implement the cart functionality. ItemDetailsScreen has addItemBtn, which returns null after the item is added. This function works fine, but the problem is that when I go to cartScreen and clear the cart, and then…
Andrey Khan
  • 183
  • 1
  • 3
  • 13
0
votes
1 answer

flutter bloc to childs

Here is the main page: child: BlocProvider( create: (_) => WelcomeCubit(context.read()), child: WelcomeForm(), And in the WelcomeForm return BlocListener(listener: (context,…
EngineSense
  • 3,266
  • 8
  • 28
  • 44
0
votes
0 answers

Flutter BLoC Functionallity of = adding item to list without fully rebuild list, changing a value of class instance property

Maybe my question is a nooby one, but i really try to understand how to implement the following operations: How to add item for a list without the need of rebuilding all list. How to update a class instance property value. Does BLoCProvider used…
AIX
  • 61
  • 2
0
votes
2 answers

Flutter - Dispose of resources and monitor number of instances of resources

I need some reassurance that I am not creating new objects without disposing of them, or need to know how I can manually monitor and dispose of them. I thought Navigator.pop() should dispose of my resources such as flutter-bloc cubits/blocs but it…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
0
votes
1 answer

Enabled button with. a state variable in a blocbuilder

I have a bloc which I use to upload images from the gallery. I then have a TextField where I enter text. And finally another bloc where I have a button. The button is used to submit the data to a server(image and text). My problem is enabling the…
flutter
  • 6,188
  • 9
  • 45
  • 78
0
votes
1 answer

Is it possible to call two methods in a bloclistener?

I'm uploading an image using the bloc pattern. I have a bloc listener that listens for for the state UploadSuccess. I'd like to call two methods in the listener, One to pop the route and another to show a snackbar: if (state is UpLoadSuccess) { …
flutter
  • 6,188
  • 9
  • 45
  • 78
0
votes
1 answer

Flutter bloc fill initial state with data

I have a question about bloc correct code placement so to say. So as bloc stands for business logic component I've moved business logic (like processing data methods) inside class. So now there are 2 methods one for getting and second for saving…
Alexander
  • 357
  • 4
  • 20
0
votes
1 answer

Change flutter localizations with bloc state managment problem

I would like to change application language every time that someone decide to change application language without restarting app. Everything is working using BLoC. The problem I have I don't really understand one thing. If I pass to MaterialApp…
TRUSTMEIMJEDI
  • 81
  • 1
  • 7
0
votes
0 answers

Flutter Blocs quick events leads to data loss

I am new to flutter and the famous flutter_bloc library. I have created a chat system based on the BLoC pattern : A widget fires an event to chatBloc The chatBloc catches the event, process it and call chatRepository ChatRepository adds the message…
Tolkar
  • 34
  • 7
0
votes
1 answer

How to correctly use a BLoC with two events for the same screen?

I'm trying to create a Movies app with bloc and clean architecture, I want to show the popular movies and the top rated movies however I can only show one of them. I'm using the same bloc for both use cases. What am I doing wrong?, should I use two…
Nestor Ariza
  • 49
  • 1
  • 6