Skip to content

Could you provide a way to test errorBuilder() of Image.network with this package? #13

@jttuboi

Description

@jttuboi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions