Of course, we should respect user preferences. If a user sets their OS to Dark Mode, every app should honor that choice. So how can we achieve this in Flutter?
// ...
MaterialApp(
// ...
darkTheme: ThemeData.dark()
// ...
);
// ...
Simply pass the ThemeData you want or have configured into darkTheme, which is one of the attributes of MaterialApp — and the magic happens!
📚 Hope you enjoy reading!