expectVisible function
Assert that a widget matching finder is visible in the widget tree.
Works with any Finder — types, keys, icons, or custom finders.
Example:
expectVisible(find.byType(FloatingActionButton));
expectVisible(find.byIcon(Icons.notifications));
expectVisible(find.byKey(Key('submit_btn')));
Implementation
void expectVisible(Finder finder) {
expect(
finder,
findsOneWidget,
reason: 'Expected widget to be visible: $finder',
);
}