debugIsHidingAncestorWidgetOfExactType<T extends Widget> static method
- BuildContext context
Returns true if a LookupBoundary is hiding the nearest
Widget of the specified type T
from the provided BuildContext.
This method throws when asserts are disabled.
Implementation
static bool debugIsHidingAncestorWidgetOfExactType<T extends Widget>(BuildContext context) {
bool? result;
assert(() {
bool hiddenByBoundary = false;
bool ancestorFound = false;
context.visitAncestorElements((Element ancestor) {
if (ancestor.widget.runtimeType == T) {
ancestorFound = true;
return false;
}
hiddenByBoundary = hiddenByBoundary || ancestor.widget.runtimeType == LookupBoundary;
return true;
});
result = ancestorFound & hiddenByBoundary;
return true;
} ());
return result!;
}