maybeOf method Null safety
- BuildContext context
The data from the closest instance of this class that encloses the given context, if there is one.
Returns null if no CupertinoUserInterfaceLevel 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:
- of, which is similar, but will throw an exception if no CupertinoUserInterfaceLevel encloses the given context.
Implementation
static CupertinoUserInterfaceLevelData? maybeOf(BuildContext context) {
assert(context != null);
final CupertinoUserInterfaceLevel? query = context.dependOnInheritedWidgetOfExactType<CupertinoUserInterfaceLevel>();
if (query != null) {
return query._data;
}
return null;
}