I have the following setup:
return Container(
child: widget.searchResult.companyLogoUrl.isEmpty
? Image.asset('assets/images/missing-company-logo.png')
: Image.network(widget.searchResult.companyLogoUrl),
)
And now I want to test that the missing logo image is loaded when no url is provided. How can I get the source url or local file after obtain the Image widget in a test?
testWidgets('given', (tester) async {
await tester.pumpWidget(createSearchResultCard(mockResponse));
await tester.pumpAndSettle();
final Image image = find.byType(Image).evaluate().single.widget as Image;
final String source = image. // How do I get the file source?
expect(...)
});
Is there a way to tell which picture has been loaded?