of method Null safety

DrawerThemeData of(
  1. BuildContext context
)

The closest instance of this class that encloses the given context.

If there is no enclosing DrawerTheme widget, then ThemeData.drawerTheme is used.

Typical usage is as follows:

DrawerThemeData theme = DrawerTheme.of(context);

Implementation

static DrawerThemeData of(BuildContext context) {
  final DrawerTheme? drawerTheme = context.dependOnInheritedWidgetOfExactType<DrawerTheme>();
  return drawerTheme?.data ?? Theme.of(context).drawerTheme;
}