import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; Finder findIconByAsset(String assetName) { return find.byWidgetPredicate( (Widget widget) => widget is IconButton && widget.icon is Image && (widget.icon as Image).image is AssetImage && ((widget.icon as Image).image as AssetImage).keyName == 'assets/icons/$assetName', ); }