of<T extends CustomThemeData> static method
Obtains the theme data of given type from the nearest storage.
If CustomThemes storage is not found and dafault data
is not provided than returns null
.
Implementation
static T? of<T extends CustomThemeData>(BuildContext context,
{T? mainDefault, T? darkDefault}) {
final isDark = Theme.of(context).brightness == Brightness.dark;
return _of(context)?.get<T>(isDark ? _getDarkFunc<T>() : null) ??
(isDark && darkDefault != null ? darkDefault : mainDefault);
}