Hey there , in this module we are going to see how we can switch between dark and light theme in our flutter app.

We are going to use BLoC pattern to listen to the boolean value of dark theme. Class Bloc takes input of the drawer switch , if switch is off then it provides false sink to Class Bloc and if the switch is on then it provides true Stream to Class Bloc.

Material app is wrapped with a Stream Builder which listens to the output Stream from Bloc Class and sets the theme accordingly.

main.dart

Now its time for you to code !!

Thanks for reading …

--

--