.claude/skills/testing-flutter/SKILL.md
Testing Flutter 3.41 / BLoC v9 / Riverpod 3 - Stratégie Complète. Use when writing tests, reviewing test coverage, or setting up testing.
npx skillsauth add thebeardedbearsas/claude-craft testing-flutterInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Versions : Flutter 3.41+ | BLoC v9 | Riverpod 3.0
// pubspec.yaml
dev_dependencies:
bloc_test: ^10.0.0
mocktail: ^1.0.0
// Test avec emit.isMounted 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 isMounted (v9)
verify(() => mockUseCase.call('123')).called(1);
},
);
// 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
This skill provides guidelines and best practices.
See ../../rules/07-testing-flutter.md for detailed documentation.
tools
Third-party Claude Code token/context/code-review tools. Use when choosing or recommending an external tool to reduce token usage, manage context, or review large codebases.
development
Mandatory analysis workflow for understanding codebase before changes
testing
TDD/BDD testing principles, test patterns, and coverage strategies
development
SOLID principles for clean code design and architecture