Issue I have a statefull widget with a Gesture detector within a Bloc Provider. @override Widget build(BuildContext context) { return RepositoryProvider.value( value: _authRepository, child: BlocProvider( create: (context) => AuthBloc(authRepository: AuthRepository()), child: Scaffold( body: GestureDetector( onTap: () { showSignInBottomSheet(context); }, ),
Continue readingCategory: Bloc
Adding custom duration to flutter_bloc's timer example
Issue I am learning flutter_bloc and did the timer example at https://bloclibrary.dev/#/fluttertimertutorial?id=flutter-timer-tutorial However the timer always resets to 60 seconds, so I wanted to the ability to set a custom initial duration. My approach: Add a field initialDuration to TimerState
Continue readingConcepts of BlocListener, BlocBuilder, and BlocProvider
Issue I am having difficulty understanding this structure. My idea is simple: I have a MultiBlocProvider in my build with two BlocProviders. The first one uses AuthBloc and immediately calls my GetToken, and the second one prepares my provider (TokenBloc).
Continue readingCan we access Bloc without Passing Buildcontext param
Issue I am migrating to GetX to Bloc, in GetController we don’t need BuildContext to call controller, so is there any way to Provide the Context to the bloc class from BlocProvider and we get bloc without providing buildContext like
Continue readingHow can I provide a bloc for only two pages of application?
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 readingWhat 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 reading