of static method

ThemeData of(
  1. BuildContext context
)

Retrieves the nearest ThemeData from the widget tree, defaulting to dark.

Implementation

static ThemeData of(BuildContext context) {
  final widget = context.dependOnInheritedWidgetOfExactType<Theme>();
  if (widget != null) {
    return widget.data;
  }
  return ThemeData.dark;
}