-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[shared_preferences] Fix a late initialized error with the example app #8540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e7ad824
[shared_preferences] Fix a late initialized error with the example app
kenzieschmoll a88794e
changelog and version
kenzieschmoll e7267ad
add test
kenzieschmoll 68d0dc7
review comments
kenzieschmoll 5002272
Merge branch 'main' into fix-example
kenzieschmoll eebbef6
version and changelog
kenzieschmoll 5c6209a
fix test
kenzieschmoll File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
fix test
- Loading branch information
commit 5c6209a3465bc3788d724e87eb98219acf400f03
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to put this code somewhere that can be imported in both locations that isn't exported to users?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short of creating a shared package for testing utilities (which seems overkill just to share code with the example app test), I'm not sure how else to share this code.
I'm not entirely sure why the relative path can be imported successfully from a test for native platforms but not for the web platform. CC @jakemac53 do you know if this behavior is expected from the test package for this case?
Another option is to add
TestOn('vm')here so that this test does not run for the web platform.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected yes, the way apps are hosted on the web we have no way to access URIs outside of the package.
The "root" of the server is either the test directory or the package directory (can't remember which), so you can only access things from the current package and then package: URIs (via synthetic /packages/ paths).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These sorts of relative paths also really shouldn't be used anyways, they can easily be broken (that file could have dependencies you don't have for instance, and pub won't be able to resolve that for you).
The solution is a shared testing package (no need to publish it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarrinneal are you okay landing this with a todo to create a shared testing package or do we need to do that as part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well :)