Hello! In Todos example we have two blocs witch are communicate with each other: FilteredTodosBloc and TodosBloc.
This is a part of code in main.dart file witch create dependencies:
BlocProvider<FilteredTodosBloc>(
create: (context) => FilteredTodosBloc(
todosBloc: BlocProvider.of<TodosBloc>(context),
),
),
How to create dependencies if i use get_it package? Because this method does not work:
BlocProvider<FilteredTodosBloc>(create: (context) => getIt<FilteredTodosBloc>()),
The same doubt
Hi @popay34 馃憢
Thanks for opening an issue!
That should work as long as you've registered both blocs properly like:
getIt.registerSingleton<TodosBloc>(TodosBloc());
getIt.registerSingleton<FilteredTodosBloc>(FilteredTodosBloc(getIt<TodosBloc>()));
Hope that helps 馃憤
Closing for now but feel free to comment if you have additional questions and I'm happy to continue the conversation 馃憤
Most helpful comment
Hi @popay34 馃憢
Thanks for opening an issue!
That should work as long as you've registered both blocs properly like:
Hope that helps 馃憤