network_image_mock
network_image_mock copied to clipboard
Could you provide a way to test errorBuilder() of Image.network with this package?
Hi, I tried to create a test like this, but haven't worked.
await mockNetworkImagesFor(() {
return tester.pumpWidget(
MaterialApp(
home: Image.network('https://this_image_doesnt_exist.png', errorBuilder: (_, __, ___) {
return const Text('error 404');
}),
),
);
});
final text = find.text('error 404');
expect(text, findsOneWidget);
I only check when the image is not valid, it shows that Text widget.