skip to Main Content

Flutter – Why BlocProvider doesn't allow to assign another list of BlocProvider which I want to import from other file?

class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MultiBlocProvider( providers: blocProviders(context), child: MaterialApp.router( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), routerConfig: AppRouter().router,…

VIEW QUESTION

flutter bloc: state does not change after changing new event

Bloc Listner Does Not change state to navigate to next screen Bloc import 'package:bloc/bloc.dart'; import 'package:bloctest/bloc/events.dart'; import 'package:bloctest/bloc/states.dart'; class AppBloc extends Bloc<AppEvent,AppState>{ AppBloc(AppState initialState):super(initialState){ on<AppStartEvent>((event, emit) { emit(AppInitState()); }); on<NavigatorButtonPressed>((event, emit) { emit(NavigationSucceedState()); print('navigation succeed'); }); } } Bloc Listner…

VIEW QUESTION

Router based navigation with flutter bloc

I am trying to build my own router similar to go_router, based on flutter_bloc. What I am trying to achieve is very similar to this guide that inspired the minimal implementation below: import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; void main()…

VIEW QUESTION
Back To Top
Search