of static method
Get the current theme from context with helpful error messaging
Implementation
static FSThemeData of(BuildContext context) {
final theme = context.dependOnInheritedWidgetOfExactType<FSTheme>();
if (theme == null) {
throw FlutterError('''
No FSTheme found in context.
To fix this, please wrap your app with FSTheme:
FSTheme(
data: FSThemeData.light(), // or FSThemeData.dark()
child: MaterialApp(...),
)
If you're using MaterialApp, make sure FSTheme is above it in the widget tree.
''');
}
return theme.data;
}