expectWidgetCount function

void expectWidgetCount(
  1. Type type,
  2. int count
)

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',
  );
}