testing-flutter
Testing Flutter 3.44 / BLoC v9 / Riverpod 3 - Stratégie Complète. Use when writing tests, reviewing test coverage, or setting up testing.
Works with
---
name: testing-flutter
description: Testing Flutter 3.44 / BLoC v9 / Riverpod 3 - Stratégie Complète. Use when writing tests, reviewing test coverage, or setting up testing.
license: MIT
---
# Testing Flutter 3.44+ - Stratégie Complète
**Versions :** Flutter 3.44+ | Dart 3.12+ | BLoC v9 | Riverpod 3.0
## Patterns de test 2026
### BLoC v9 Tests avec bloc_test
```dart
// pubspec.yaml
dev_dependencies:
bloc_test: ^10.0.0
mocktail: ^1.0.0
// Test avec emit.isDone checks (BLoC v9)
blocTest<UserBloc, UserState>(
'emits [loading, loaded] when FetchUser is added',
build: () {
when(() => mockUseCase.call('123'))
.thenAnswer((_) async => User(id: '123', name: 'Alice'));
return UserBloc(getUserUseCase: mockUseCase);
},
act: (bloc) => bloc.add(const FetchUser('123')),
expect: () => [
const UserState(status: UserStatus.loading),
const UserState(status: UserStatus.loaded, user: User(id: '123', name: 'Alice')),
],
verify: (bloc) {
// Vérifier que le bloc respecte isDone (v9)
verify(() => mockUseCase.call('123')).called(1);
},
);
```
### Riverpod 3.0 Mutations Tests
```dart
// Test Riverpod 3.0 Mutations API
test('Mutation updates state correctly', () async {
final container = ProviderContainer();
// Initial state
final notifier = container.read(orderNotifierProvider('123').notifier);
expect(container.read(orderNotifierProvider('123')).value?.id, '123');
// Mutation
await notifier.updateOrder(Order(id: '123', name: 'Updated'));
// Verify state après mutation
expect(
container.read(orderNotifierProvider('123')).value?.name,
'Updated',
);
container.dispose();
});
```
**Source :** [Riverpod 3.0 Testing](https://medium.com/@lee645521797/flutter-riverpod-3-0-released-a-major-redesign-of-the-state-management-framework-f7e31f19b179)
---
This skill provides guidelines and best practices.
See ../../rules/07-testing-flutter.md for detailed documentation.More Testing skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
setup-pre-commit
mattpocock/skills
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

