of static method
Find InspectableState which is found as a closest descendant of given context
.
Usually this method is used with inspect method.
Implementation
static InspectableState of(BuildContext context) {
final state = context.findAncestorStateOfType<InspectableState>();
assert(() {
if (state == null) {
throw FlutterError(
'Inspectable operation requested with a context that does not include a Inspectable.\n'
'The context used to inspect widgets from the Inspectable must be that of a '
'widget that is a descendant of a Inspectable widget.');
}
return true;
}());
return state!;
}