of static method

ZefyrThemeData? of(
  1. BuildContext context, {
  2. bool nullOk = false,
})

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

Returns null if there is no ZefyrTheme in the given build context and nullOk is set to true. If nullOk is set to false (default) then this method asserts.

Implementation

static ZefyrThemeData? of(BuildContext context, {bool nullOk = false}) {
  final widget = context.dependOnInheritedWidgetOfExactType<ZefyrTheme>();
  if (widget == null && nullOk) return null;
  assert(widget != null,
      '$ZefyrTheme.of() called with a context that does not contain a ZefyrEditor.');
  return widget!.data;
}