Closed ljoly83 closed 6 months ago
Description MultiBlocProvider doesn't work with easy_localization library if declared before MaterialApp
Steps To Reproduce
This work: class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( localizationsDelegates: context.localizationDelegates, supportedLocales: context.supportedLocales, locale: context.locale, theme: ThemeData( primarySwatch: Colors.blue, ), home: MultiBlocProvider( providers: [ BlocProvider( create: (_) => GetUserBloc(GetUserUseCase()), ) ], child: UserView(), )); } }
This doesn't work (but should)
@override Widget build(BuildContext context) { return MultiBlocProvider( providers: [ BlocProvider( create: (_) => GetUserBloc(GetUserUseCase()), ) ], child: MaterialApp( supportedLocales: context.supportedLocales, localizationsDelegates: context.localizationDelegates, locale: context.locale, home: const UserView(), ), ); } }
Expected Behavior It should work with MultiBlocProvider at top level as it is the recommand way. .
I close as the first solution finaly dont work. Have to found the issue.
Description MultiBlocProvider doesn't work with easy_localization library if declared before MaterialApp
Steps To Reproduce
This work: class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( localizationsDelegates: context.localizationDelegates, supportedLocales: context.supportedLocales, locale: context.locale, theme: ThemeData( primarySwatch: Colors.blue, ), home: MultiBlocProvider( providers: [ BlocProvider( create: (_) => GetUserBloc(GetUserUseCase()), ) ], child: UserView(), )); } }
This doesn't work (but should)
@override Widget build(BuildContext context) { return MultiBlocProvider( providers: [ BlocProvider( create: (_) => GetUserBloc(GetUserUseCase()), ) ], child: MaterialApp( supportedLocales: context.supportedLocales, localizationsDelegates: context.localizationDelegates, locale: context.locale, home: const UserView(), ), ); } }
Expected Behavior It should work with MultiBlocProvider at top level as it is the recommand way. .