byTooltip method
Finds Tooltip widgets with the given message
.
Sample code
expect(find.byTooltip('Back'), findsOneWidget);
expect(find.byTooltip(RegExp('Back.*')), findsNWidgets(2));
If the skipOffstage
argument is true (the default), then this skips
nodes that are Offstage or that are from inactive Routes.
Implementation
Finder byTooltip(Pattern message, {bool skipOffstage = true}) {
return byWidgetPredicate(
(Widget widget) {
return widget is Tooltip &&
(message is RegExp
? ((widget.message != null && message.hasMatch(widget.message!)) ||
(widget.richMessage != null && message.hasMatch(widget.richMessage!.toPlainText())))
: ((widget.message ?? widget.richMessage?.toPlainText()) == message));
},
skipOffstage: skipOffstage,
);
}