We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 821d738 + 20bf6dc commit f376755Copy full SHA for f376755
lib/src/helpers/await_images.dart
@@ -30,12 +30,14 @@ extension AwaitImages on WidgetTester {
30
for (final element in find.byType(DecoratedBox).evaluate().toList()) {
31
final widget = element.widget as DecoratedBox;
32
final decoration = widget.decoration;
33
- if (decoration is BoxDecoration) {
34
- final image = decoration.image?.image;
35
- if (image != null) {
36
- await precacheImage(image, element);
37
- await pump();
38
- }
+ final image = switch (decoration) {
+ BoxDecoration() => decoration.image?.image,
+ ShapeDecoration() => decoration.image?.image,
+ _ => null,
+ };
+ if (image != null) {
39
+ await precacheImage(image, element);
40
+ await pump();
41
}
42
43
});
0 commit comments