Solution: Calling Themes from Code

In this lesson, you'll explore the solution to the "Calling Themes from Code" challenge.

We'll cover the following

Solution: Calling themes

In this challenge, you’ll learn how to call a different theme to apply it to the app globally.

You need to switch from the light theme to a dark theme.

  • Light theme can be applied using MyAppThemes.appThemeLight().
  • Dark theme can be applied using MyAppThemes.appThemeDark().
MaterialApp(
 debugShowCheckedModeBanner: false,

 //SOLUTION: Dark theme is applied
 theme: MyAppThemes.appThemeDark(),

 home: Scaffold(
   appBar: buildAppBarWidget(),
   body: buildBodyWidget(),
 ),
)

Get hands-on with 1200+ tech skills courses.