Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created September 9, 2025 08:29
Show Gist options
  • Select an option

  • Save YonatanKra/9984e00f79661cadf56348989b11c5c6 to your computer and use it in GitHub Desktop.

Select an option

Save YonatanKra/9984e00f79661cadf56348989b11c5c6 to your computer and use it in GitHub Desktop.
Flutter widget simple test - approach one
testWidgets(‘should display “mock_first” text’, (WidgetTester tester) async {
await tester.pumpWidget(
ChangeNotifierProvider<MyAppState>(
create: (context) => MockAppState(),
child: MaterialApp(home: MyHomePage()),
),
);
expect(find.text(‘mock_first’), findsOneWidget);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment