init static method
Initializes the theme manager with the supported themes.
Must be awaited before runApp. The initial theme is the previously saved one,
otherwise the first theme matching the system brightness, otherwise the first theme.
Throws AppThemeException if themes is empty or contains duplicate keys.
Implementation
static Future<void> init({required List<AppTheme> themes}) async {
if (themes.isEmpty) {
throw const AppThemeException(ThemeExceptionConstants.emptyThemes);
}
if (themes.map((t) => t.key).toSet().length != themes.length) {
throw const AppThemeException(ThemeExceptionConstants.duplicateKeys);
}
WidgetsFlutterBinding.ensureInitialized();
_appThemes = List.unmodifiable(themes);
await AppThemeDependencyInjection.configure(themes: _appThemes);
}