All Questions
2,203 questions
0
votes
0
answers
8
views
Bloc plugin generates empty files often (Flutter)
Maybe anyone knows why the Bloc plugin in the Android Studio generates the empty files when you are creating the new templates?
I tried to invalidate caches, restart IDE, reinstall the bloc plugin.
...
0
votes
1
answer
35
views
How can I pass bloc to another screen in flutter [duplicate]
in main.dart
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: ...
0
votes
0
answers
24
views
DartError: LateInitializationError: Field '__storage' has not been initialized when updating from hydrated_bloc 9 to 10 and flutter_bloc 8 to 9
i follow the migration guide https://bloclibrary.dev/migration/ but i get this error
DartError: LateInitializationError: Field '__storage' has not been initialized.
dart-sdk/lib/_internal/...
1
vote
1
answer
46
views
How to make Material Autocomplete work with Bloc?
I'm trying to combine Material Autocomplete widget with Bloc pattern for Google Place Autocomplete function.
My code as below:
BlocBuilder<MyBloc, MyState>(
builder: (context, state) {
...
0
votes
0
answers
28
views
how to verify the content of bloc state in flutter web in chrome?
How to verify the content of bloc state in flutter web in chrome?
For now, the content in Chrome dev tool show in binary content, how to check the physical location of the file and content?
I don't ...
1
vote
1
answer
29
views
How do I access a Bloc declared in MultiBlocProvider from a page accessed via a route?
I'm relatively new to Flutter and Bloc and am confused on how to use the MultiBlocProvider correctly. I have a list page and a create page, to create an item for the list.
I've tried:
putting the ...
1
vote
1
answer
25
views
Executing Bloc Events Synchronously Across Different Blocs
I need to execute multiple events from different Blocs synchronously, ensuring that each event completes before the next one starts. Here's the current code:
context.read<PaymentBloc>().add(...
0
votes
1
answer
45
views
Screen not reacting to Bloc event after navigating
So I currently have 2 screens, one screen has a button and when the user presses the button, second screen gets displayed. Nothing too complicated...
The second screen should react to what the Bloc ...
0
votes
1
answer
30
views
Using HydratedBloc -- LateInitilizationError Field '__storage@30190796' has not been initialized
I am trying to learn Flutter and Bloc/ HydratedBloc. I can't seem to get past an exception I keep getting when trying to save a value to local storage. I have tried creating this new simpler project, ...
0
votes
1
answer
45
views
HydratedBloc expects a type HydratedStorageDirectory but getApplicationDocumentsDirectory returns a type of Directory
I am new to Flutter and currently trying to learn Bloc and HydratedBloc. I am trying to initialize the storage using getApplicationDocumentDirectory() and use it for the storageDirectory parameter in ...
0
votes
0
answers
20
views
Flutter Mqtt callback with BLoC
I'm building a Flutter Embedded application that uses MQTT to communicate between processes. Currently, I have a repository that subscribes to specific MQTT topics, but I want to improve it by ...
1
vote
0
answers
51
views
Problem with the state of the category selection buttons
I have containers with various specialties. They are taken from the API. I have a problem with updating the state of the buttons. I will give an example in the video of how it should work and how it ...
0
votes
0
answers
41
views
Clicking on a TextFormField Widget rebuilds the parent widget
I am facing a problem where clicking on a text field is rebuilding my entire parent widget, interestingly it is being rebuilt multiple times. I have seen similar questions and followed the suggestions ...
0
votes
0
answers
43
views
Widgets don't rebuild using go_router and async redirect
I've been trying to implement navigation from login page to home page based on authentication status from firebase.
Untill now Ive had this simply done with bloc listener (therefore I know the whole ...
0
votes
0
answers
17
views
How to test nested bloc event's
I'm writing unit test for my bloc event's. And some event's triggered other event's inside itself. I used expect to test state changes. But when nested event't triggered expect expects state change's ...
0
votes
0
answers
16
views
Flutter - individual bloc states
Im building an application that queries stock data from an api, I use bloc for state management but I dont know how to handle each stock data state, currently I have defined a bloc and it has all the ...
1
vote
0
answers
19
views
Unable to trigger listeners in bloc event integration test
I'm doing an integration test, where I want to trigger an event change after a submit button. below is my setup for the test as well as the actual test, I've tried multiple ways and positions to set ...
0
votes
0
answers
32
views
How to implement Bloc state management for a map with filters and a searchable marker list
I am working on a Flutter application where I want to manage the state of a map using the Bloc pattern. The map has the following functionalities:
Markers Display:
By default, the map shows a list ...
0
votes
0
answers
17
views
Flutter Bloc Listener Not Detecting New States and Failing to Update Map Markers
I’m using flutter_bloc in a Flutter application to manage the state of a GoogleMap. The BlocListener is responsible for reacting to state changes emitted by a Cubit, such as new student locations or ...
0
votes
1
answer
29
views
Dependent multiple dropdown issues using bloc in Flutter
I have a screen where there are 2 dropdown widgets. When I select first dropdown and want to show a loading widget then I am getting error.
My problems are:
When I select territory then app is ...
0
votes
1
answer
30
views
Could not find the correct Provider<CubitSubject> above this BlocBuilder widget in Flutter
I'm facing an issue with accessing my CubitSubject provider in a specific screen. I have a MultiBlocProvider in the root of my app, and I'm trying to access the CubitSubject in the SubjectsView screen....
1
vote
1
answer
64
views
How do I access multiple BloCs from a single component in Flutter Flame?
I am building a Flutter Flame game and am trying to have a single action add events to two different blocs. For example, when the character picks up an item I want it to go into an InventoryBloc and ...
1
vote
0
answers
19
views
multiple Instances of screen injected Flutter Bloc with OnGenerateRoute
I am working on a Flutter app using the Bloc pattern for state management, and I’m encountering an issue where multiple routes are being pushed onto the navigation stack despite having a single ...
1
vote
0
answers
50
views
Why doesn't the Autocomplete widget update the suggestions when rebuilt?
I'm trying to build a search bar where the user can look up for a place, and select a suggestion corresponding on what caracters they wrote.
I'm using BLOC, and an API to fetch the suggestions from ...
1
vote
1
answer
44
views
Flutter blocs with API requests
I am getting response data from an api while passing in a response body. I have built my state, event, repository of my request but upon calling the user details event in my home page where I want to ...
1
vote
1
answer
37
views
Vscode shows explorer files red after running build runner
I'm using the build runner package in my Flutter project. But whenever I ran the following command
dart run build_runner build
Some of the bloc state files turn red in the vscode file explorer. I ...
1
vote
0
answers
33
views
Optimization of videos from Flutter App Api Call
I list videos from api on my page in Flutter.I used the PreloadPageView 'preload_page_view' package to list the videos.The videos are in mp4 format. Video sizes average between 100-200 mb. I make the ...
1
vote
1
answer
49
views
Flutter bloc event is not getting called on initial screen load
I just started with flutter bloc and I want to call an event on screen initial load. I have the following code but the event AuthEventCheck is not getting called.
void main() {
runApp(const MainApp()...
1
vote
2
answers
66
views
flutter Bloc + Freezed is not emitting the same state twice. UI is not rebuilding
I'm trying to update state after creating an Object.
I've created ObjectsState using freezed package, so there is no sence to use Equatable, because it is already add by package.
class ObjectsState ...
1
vote
1
answer
129
views
Does Bloc Rebuild (BlocBuilder) The Whole Widget Tree When New State emitted?
I encountered an issue when I wrapped my MaterialApp widget in a BlocBuilder. I expected the entire widget tree to rebuild whenever a new state was emitted. However, I noticed that some widgets didn’t ...
0
votes
0
answers
20
views
Using generics to create reusable Widget which can use different Instances of same Bloc
i am completely new to generics and I am struggling to get this running.
I want to create a Reusable Page with a BlocProvider.
I am creating multiple Instances of one Bloc to save code using mixins on ...
1
vote
0
answers
18
views
Flutter Guest Access with Bloc and go_router
Trying to implement guest access to my app,
The app flow goes as this: Walkthrough screen (/onboarding) => user can either login/signup/continueAsguest after the first installation as the user ...
1
vote
0
answers
37
views
How to use Bloc with Freezed package while running 2 api requests? What is best approach?
can someone explain what solution I can implement in this issue?
I have one screen, where I have two requests (later there will be more requests). I thought the best approach is to separate this two ...
0
votes
1
answer
55
views
How can i give my AppLifecycleListener BuildContext?
I need inside my AppLifecycleListener context to execute cubit functions. How can put BuildContext inside my Listener of AppLifecycleListener?
_listener = AppLifecycleListener(
onStateChange: ...
0
votes
1
answer
44
views
How to handle multi states
i am building an app with flutter and firebase backed in which the user can go to a profile screen to edit it.
The profile has 2 parts, a view one, where the user can view all its data, verify its ...
0
votes
2
answers
51
views
How to execute cubit function from a void function of a class in Flutter
how you are calling a cubit function from a void function of stateless/ful widget. I assume in an ideal world all functions should be placed in cubits but similar to context.read<MyCubit>()....
0
votes
0
answers
42
views
App gets stuck on getServiceStatusStream()
In my Flutter app project, I'm working to track whether the user’s location services are enabled or disabled, using the Bloc architecture.
Initially, I used the Geolocator.isLocationServiceEnabled() ...
1
vote
2
answers
30
views
BottomNavigationBar not rebuilding as part of a BlocConsumer
Hey there I'm pretty new to flutter. I'm trying to get my BottomNavigationBar running. I'm using the bloc package for state changes, sending out an event when tapping on a BottomNavigationBar. I have ...
0
votes
0
answers
15
views
Bloc Turns Null After Initializing Subscribed Cubits
I have a bloc called WorkItemDetailsBloc, which is subscribed to two cubits: AttachmentsCubit and FollowersCubit. I use these subscriptions to be able to update the UI when the user updates either ...
0
votes
0
answers
104
views
Why I'm not getting the otp autofilled?
I'm currently implementing SMS autofill to capture an OTP from Firebase, but I haven't had success so far. I'm using both Bloc and sms_autofill in my setup. Despite trying various approaches, the OTP ...
0
votes
2
answers
52
views
Bloc emit state issue
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:moms/features/chat/domain/entities/message_entity.dart';
import 'package:moms/features/chat/domain/usecases/send_message.dart';
import '...
-1
votes
1
answer
67
views
How to manage multiple states in a single BLoC without affecting the UI? [closed]
I'm developing a Flutter application using the BLoC pattern. I have a single UI page that interacts with a BLoC that handles 5 events and 10 states. My requirement is as follows:
When I fire an event ...
0
votes
1
answer
45
views
You used a `BuildContext` that is an ancestor of the provider you are trying to read
Error: Could not find the correct Provider above this RegisterScreen Widget
This happens because you used a BuildContext that does not include the provider
of your choice. There are a few common ...
0
votes
1
answer
41
views
I don't know the value returned to me when testing bloc in Flutter
Im developing an app on Flutter. I want to test bloc using mockito but I don't know response. (status code:200 but response is a very big and dynamic model)
I read the same example in every source, I ...
0
votes
0
answers
56
views
Undefined behavior of BlocProvider
I decided to use bloc's constructs inside the build() function of all screens and encountered undefined behavior.
I have several blocs: ThemeBloc, AuthBloc, NotesBloc. ThemeBloc and NotesBloc work ...
0
votes
0
answers
37
views
How to open modal sheet only once using Bloc
Scenario is I want to open modal sheet when state is GetExperienceLoadedState and AppStrings.isFeedbackForFinancing == true and I am calling an API on initState method.
Modal sheet is appearing but ...
0
votes
0
answers
37
views
Unit Testing a Bloc in Flutter: States Not Emitting as Expected
I'm working on a Flutter application using the BLoC pattern, and I'm currently facing an issue with my AuthenticationBloc during unit testing. My unit test is supposed to emit two states: loading and ...
1
vote
0
answers
37
views
Preventing Unnecessary Rebuilds in BlocBuilder with Form State Management
I have a state (formState) and multiple form-based input widgets like TextFormField, Dropdown, and others. Each widget has an onChange function and events, and the widgets are wrapped around a ...
2
votes
1
answer
114
views
How to access state of another bloc in Flutter bloc
I'm relatively new to flutter bloc state management, so here is the scenario where I would be needing to access state of another bloc
there are two bloc in my flutter app, the first one is UserBloc ...
1
vote
1
answer
71
views
why Bad state: add(LoginEvent) was called without a registered event handler. Make sure to register a handler via on<LoginEvent>((event, emit) {...})
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:pooling_apps/data/repositories/auth_repository.dart';
import 'package:pooling_apps/models/user_model.dart';
import 'auth_event.dart';
...