Baseflow / Baseflow/flutter_cached_network_image

ImageBuilder is never called during the tests in flutter with CachedNetworkImage

Open
#718 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Dart
Stars
2.6k
Forks
731
Avg merge
3d 9h
Merged PRs (30d)
1

Description

Hello,

I'm having an issue with the widget tests using the CachedNetworkImage. The problem is the imageBuilder is never called.You can reproduce the behavior with this test:

```dart
testWidgets("CircleAvatar shown", (WidgetTester tester) async {
await mockNetworkImagesFor(() async {
await tester.pumpWidget(
CachedNetworkImage(
imageUrl: "https://imgur.com/aZyQZTZ",
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) => CircleAvatar(child: Icon(Icons.broken_image)),
imageBuilder: (context, imageProvider) => CircleAvatar(backgroundImage: imageProvider),
),
);
expect(find.byType(CachedNetworkImage), findsOneWidget); // OK
expect(find.byType(CircleAvatar), findsOneWidget); // Fail
});
});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.