expectWidgetCount function
Assert that a widget of the given type appears exactly count times.
Example:
expectWidgetCount(ListTile, 3);
expectWidgetCount(Icon, 0);
Implementation
void expectWidgetCount(Type type, int count) {
expect(
find.byType(type),
findsNWidgets(count),
reason: 'Expected $count widget(s) of type $type',
);
}