ThemeProviderBuilder constructor

const ThemeProviderBuilder({
  1. Key? key,
  2. required Widget builder(
    1. BuildContext,
    2. ThemeProvider
    ),
  3. Widget? loadingWidget,
})

To add theme management in the app, modify the build method in your main.dart as follow:

return ThemeProviderBuilder(
    builder: (context, themeProvider) => MaterialApp(
            [...]
            themeMode: themeProvider.themeMode,
            theme: themeProvider.lightTheme,
            darkTheme: themeProvider.darkTheme,
            [...]
        ),
);

Implementation

/// ```dart
/// return ThemeProviderBuilder(
///     builder: (context, themeProvider) => MaterialApp(
///             [...]
///             themeMode: themeProvider.themeMode,
///             theme: themeProvider.lightTheme,
///             darkTheme: themeProvider.darkTheme,
///             [...]
///         ),
/// );
const ThemeProviderBuilder(
    {Key? key, required this.builder, this.loadingWidget})
    : super(key: key);