of method Null safety

TimePickerThemeData of(
  1. BuildContext context
)

The data value of the closest TimePickerTheme ancestor.

If there is no ancestor, it returns ThemeData.timePickerTheme. Applications can assume that the returned value will not be null.

Typical usage is as follows:

TimePickerThemeData theme = TimePickerTheme.of(context);

Implementation

static TimePickerThemeData of(BuildContext context) {
  final TimePickerTheme? timePickerTheme = context.dependOnInheritedWidgetOfExactType<TimePickerTheme>();
  return timePickerTheme?.data ?? Theme.of(context).timePickerTheme;
}