fix: provide AppSettingsService in tcp_flow_test#301
Merged
zjs81 merged 2 commits intoMar 16, 2026
Conversation
TcpScreen.initState reads AppSettingsService from context to pre-fill host/port fields, but the test helper only provided MeshCoreConnector. Switch to MultiProvider so AppSettingsService is also in the widget tree.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the TCP flow widget tests to provide AppSettingsService in the widget tree, matching the runtime dependency expectations of TcpScreen/related screens.
Changes:
- Add
AppSettingsServiceimport to the TCP flow test. - Wrap the test
MaterialAppin aMultiProviderand register bothMeshCoreConnectorandAppSettingsService.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tcp_flow_test.dartfails withProviderNotFoundExceptionforAppSettingsServicebecause the test helper_buildTestApponly wraps the widget tree withChangeNotifierProvider<MeshCoreConnector>.TcpScreen.initStatecallscontext.read<AppSettingsService>()to pre-fill the host/port text fields from saved settings, which throws when no provider is in the tree.Fix
Switch
_buildTestAppfrom a singleChangeNotifierProviderto aMultiProviderthat also providesAppSettingsService(default constructor — no saved settings needed for tests).All 5 tcp_flow_test cases and the full 93-test suite pass.