I have a problem here.
I am using flutter BloC
.
I Have Two block need to be applied to the app (Theme and Language).
I used MultiBlocProvider
with Builder
to clear the code as possible.
The problem is when I press the buttons in Localization Screen & The Theme Screen The App NOT Re-Build
but when I restart the app, I found the state I pressed is stored in shared preference
Example The Current State is dark Theme, I press The Light Theme Button, the app is still in dark theme, When I re-started the app, It’s is opened in Light Theme.
How can I Solve this problem
I Uploaded the code to GitHub on the following Link
https://github.com/MaxJan2010/flutter_bloc_starting_project
Can any body help please
Thanks in Advance
3
Answers
Wrap theme with ThemeBlocBuilder and wrap locale with LocaleBlocBuilder this will make your screen updates as your state changes
You can make use of the BlocBuilder widgets more effectively.
Below is the code:
use BlocBuilder above the MaterialApp Widget