testWidgets("increment", (tester) async {
final key = GlobalKey();
await tester.pumpWidget(
ChangeNotifierProvider(
builder: (context) => Counter.withInitialValues(),
child: MaterialApp(
home: Consumer(
builder: (context, counter, child) => FlatButton(
key: key,
onPressed: () => counter.increment(),
child: Text(counter.number.toString())),
),
),
),
);
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
await tester.tap(find.byKey(key));
await tester.pumpAndSettle();
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});