Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Updates shared_preferences_foundation's legacy implementation to use DI to inject the fake Pigeon API implementation, instead of the Dart test generator, matching the newer async code.

Also updates shared_preferences_android to remove dartHostTestHandler entries that were unused.

Part of flutter/flutter#159886

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@stuartmorgan-g stuartmorgan-g added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Oct 29, 2025
@stuartmorgan-g
Copy link
Collaborator Author

CHANGELOG/version overrides: While technically there is production code change here, it's just adding an optional, visibible-only-for-tests parameter, and moving one ivar initialization from the declaration to the constructor, so it's pretty clearly a no-op.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the testing approach for shared_preferences_foundation by removing the dependency on Pigeon's Dart test generator. Instead, it introduces dependency injection (DI) to provide a mock implementation of the Pigeon API for tests. This aligns the legacy code with the newer async implementation and improves test isolation. The changes also include removing unused dartHostTestHandler configurations from the Android implementation's Pigeon files. My review focuses on improving the test code's maintainability and efficiency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: shared_preferences platform-android platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant