Dynamic Theme in Flutter

Dynamic Theme means changing/updating themes on the fly from anywhere inside the app.

dynamic_theme: ^1.0.1
Dynamic theme PRO Coach
return DynamicTheme(
data: (Brightness brightness) =>
brightness == Brightness.light ? lightTheme : darkTheme,
themedWidgetBuilder: (BuildContext context, ThemeData theme) =>
MaterialApp(
theme: theme,
title: 'Dynamic theme',
home: DynamicThemeExample(),
),
);
void toggleTheme() {
//toggle the theme from dark to light
Brightness currentBrightness=DynamicTheme.of(context).brightness;
DynamicTheme.of(context).setBrightness(
currentBrightness==Brightness.light
?Brightness.dark:Brightness.light);
}
DynamicTheme.of(context).setThemeData()

**Subscribe for upcoming posts. Thanks for reading. Let me know what you think about this post.

Writer , Speaker, Instructor and Flutter Dev