useMaterialTheme function
Get ThemeData without context.
Uses global provider state or optional scoped context.
final theme = useMaterialTheme();
print(theme.primaryColor);
Implementation
ThemeData useMaterialTheme([BuildContext? context]) {
if (context != null) {
return Theme.of(context);
}
return getProviderState().materialTheme;
}