Issue in my application there are a couple of pages. two pages need to use one bloc. I use namedRoutes for navigating between pages and the BlocProvider is on the top of app widget so it is provided for all
Continue readingCategory: Bloc
What is the best way to using BLoC, one BLoC per screen or one BLoC per part of screen?
Issue I’m currently developing the Flutter application using BLoC with flutter_bloc and I wonder what is the best way to manage the state using BLoC. In my situation, there’re two main separate parts on the same screen. So, I end
Continue readingA value of type 'Null' can't be returned from the method 'onGenerateRoute' because it has a return type of 'Route<dynamic>'
Issue Actually I was trying to add genearatedRoute but i was facing this error A value of type ‘Null’ can’t be returned from the method ‘onGenerateRoute’ because it has a return type of ‘Route’ Below is my code class AppRouter
Continue readinghow to transfer this code in flutter_bloc V7 to flutter_bloc V8?
Issue the problem is that I want to transfer this code from bloc 7 to bloc 8 using emit and on<RunLongRunningStreamedEvent and i know that mapEventtoState no longer exisits import ‘package:bloc/bloc.dart’; import ‘data/repository/irepository.dart’; import ‘home_event.dart’; import ‘home_state.dart’; class HomeBloc extends
Continue readingReceiving data as null in provider
Issue This is My Repository class DB { final db = FirebaseFirestore.instance; Stream<QuerySnapshot> init(UserModel user) { return db .collection(‘CollectionName’) .doc(user.email) //this is a unique value which i want to retrieve the value from main after successful login .collection(‘New Collection’) .snapshots();
Continue readingError: 'sthrow' isn't a type. sthrow ProviderNotFoundException(T, context.widget.runtimeType);
Issue I have problem when I use bloc. /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:7: Error: ‘sthrow’ isn’t a type. sthrow ProviderNotFoundException(T, context.widget.runtimeType); ^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:14: Error: Expected ‘;’ after this. sthrow ProviderNotFoundException(T, context.widget.runtimeType); ^^^^^^^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:41: Error: Expected ‘)’ before this. sthrow ProviderNotFoundException(T, context.widget.runtimeType); ^ 2 FAILURE:
Continue readingBefore the BlocListener occur, the state has updated in Flutter
Issue Top of the widget tree I have blocprovider with "lazy: False" parameter (authCubit) and with this, I can immediately listen to the auth changes. I also have a landing page, and it’s exactly using BlocListener. The problem is, first
Continue readingHow to use HydratedBloc with Freezed in Flutter
Issue I want to ask a question that is about a hydrated bloc with Freezed. Firstly, I know that the we use freezed package to gain a time. We do not create all the necessary codes like creating copyWith method
Continue readingHow to change state of cubit?
Issue image description here I want to change the state of cubit after 4 seconds when i click the button but it gives error : **BlocProvider.of() called with a context that does not contain a TestCubit. ======== Exception caught by
Continue readingFlutter: Context in FloatingActionButton cannot find the provider of <Bloc>
Issue It’s my first time using the BLoC pattern in Flutter. I have ran into a problem with providers and context. Here is my main.dart file. import ‘package:flutter/material.dart’; import ‘package:flutter_bloc/flutter_bloc.dart’; import ‘package:my_rescue/modules/screens/homepage/bloc/homepage_bloc.dart’; import ‘package:my_rescue/widgets/drawer.dart’; import ‘package:my_rescue/widgets/text_button.dart’; import ‘package:my_rescue/widgets/weather_forecast.dart’; import ‘package:my_rescue/widgets/app_bar.dart’;
Continue reading