of static method

ThemeData of(
  1. BuildContext context
)

Retrieves the closest ThemeData from the BuildContext.

Defaults to ThemeData.dark if no Theme is found in the ancestor path.

Implementation

static ThemeData of(BuildContext context) {
  final theme = context.dependOnInheritedWidgetOfExactType<Theme>();
  return theme?.data ?? ThemeData.dark;
}