getCurrentTheme static method
Gets the current theme data from Bloc state
Parameters:
context: BuildContext for accessing Bloc state
Returns ThemeData of current theme or null if not initialized
Throws Exception with message from ThemeExceptionConstants if Bloc access fails
Implementation
static ThemeData? getCurrentTheme({required BuildContext context}) {
try {
return context.read<AppThemeBloc>().state.theme;
} catch (e) {
throw Exception(ThemeExceptionConstants.appThemeMessage);
}
}