debugCheckHasFlyout function
Asserts that the given context has a Flyout ancestor.
To call this function, use the following pattern, typically in the relevant Widget's build method:
assert(debugCheckHasFlyout(context));
Does nothing if asserts are disabled. Always returns true.
Implementation
bool debugCheckHasFlyout(BuildContext context) {
assert(() {
if (Flyout.maybeOf(context) == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('No Flyout found.'),
ErrorDescription(
'${context.widget.runtimeType} widgets require a Flyout '
'to be provided by a Flyout widget ancestor.',
),
ErrorHint(
'To introduce a Flyout, use the showFlyout method or related methods.',
),
...context.describeMissingAncestor(expectedAncestorType: Flyout),
]);
}
return true;
}());
return true;
}