of method Null safety

SfThemeData of(
  1. BuildContext context
)

The data from the closest SfTheme instance that encloses the given context.

Defaults to SfThemeData.fallback if there is no SfTheme in the given build context.

Implementation

static SfThemeData of(BuildContext context) {
  final _SfInheritedTheme? inheritedTheme =
      context.dependOnInheritedWidgetOfExactType<_SfInheritedTheme>();
  return inheritedTheme?.data ??
      (Theme.of(context).brightness == Brightness.light
          ? SfThemeData.light()
          : SfThemeData.dark());
}