expectNotVisible function

void expectNotVisible(
  1. Finder finder
)

Assert that no widget matching finder is visible in the widget tree.

Works with any Finder — types, keys, icons, or custom finders.

Example:

expectNotVisible(find.byType(ErrorBanner));
expectNotVisible(find.byIcon(Icons.error));
expectNotVisible(find.byKey(Key('loading_spinner')));

Implementation

void expectNotVisible(Finder finder) {
  expect(
    finder,
    findsNothing,
    reason: 'Expected widget to not be visible: $finder',
  );
}