of static method

CupertinoUserInterfaceLevelData of(
  1. BuildContext context
)

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

You can use this function to query the user interface elevation level within the given BuildContext. When that information changes, your widget will be scheduled to be rebuilt, keeping your widget up-to-date.

See also:

Implementation

static CupertinoUserInterfaceLevelData of(BuildContext context) {
  final CupertinoUserInterfaceLevel? query = context.dependOnInheritedWidgetOfExactType<CupertinoUserInterfaceLevel>();
  if (query != null) {
    return query._data;
  }
  throw FlutterError(
    'CupertinoUserInterfaceLevel.of() called with a context that does not contain a CupertinoUserInterfaceLevel.\n'
    'No CupertinoUserInterfaceLevel ancestor could be found starting from the context that was passed '
    'to CupertinoUserInterfaceLevel.of(). This can happen because you do not have a WidgetsApp or '
    'MaterialApp widget (those widgets introduce a CupertinoUserInterfaceLevel), or it can happen '
    'if the context you use comes from a widget above those widgets.\n'
    'The context used was:\n'
    '  $context',
  );
}