Could we make Materials `InheritedTheme` Public?

I’m assuming there are some Flutter maintainers/geniuses who can give me insight before I open a PR?

Material’s theme data can only be accessed using Theme.of(context) which will subscribe to the widget to the theme.

However there is no other way if I just want to read the theme without subscribing to it. (e.g. read the theme in a onTap callback).

To read an inherited widget without subscriving, we use the context.getInheritedWidgetOfExactType<T>() method. However the widget which holds the material data is private.

So my question is, why is it private? Can we make it public (e.g InheritedMaterialTheme)

1 Like