-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[shared_preferences] allow custom key prefixes #3465
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
Conversation
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.
I considered having a defaultPrefix and a nullable prefix and checking to see if prefix were null instead. This seemed "more readable" so I went with this.
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 could be changed to an assert, or a state error if not set up correctly, similar to the main package setPrefix method
cyanglaz
left a comment
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.
iOS LGTM
ditman
left a comment
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.
Web bits LGTM. Thanks for adding this feature!
(Small question about the need for the static setPrefix method)
packages/shared_preferences/shared_preferences/lib/shared_preferences.dart
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences/lib/shared_preferences.dart
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences/lib/shared_preferences.dart
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences/lib/shared_preferences.dart
Outdated
Show resolved
Hide resolved
...ndroid/android/src/main/java/io/flutter/plugins/sharedpreferences/MethodCallHandlerImpl.java
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart
Outdated
Show resolved
Hide resolved
...ndroid/android/src/main/java/io/flutter/plugins/sharedpreferences/MethodCallHandlerImpl.java
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart
Outdated
Show resolved
Hide resolved
...preferences/shared_preferences_platform_interface/lib/method_channel_shared_preferences.dart
Outdated
Show resolved
Hide resolved
...erences/shared_preferences_platform_interface/lib/shared_preferences_platform_interface.dart
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences_linux/lib/shared_preferences_linux.dart
Outdated
Show resolved
Hide resolved
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 feels particularly fragile at the moment, in the way it interacts with remove and setValue. I can rework the way the cached preferences are gotten to avoid this interaction if people agree that it's problematic here.
stuartmorgan-g
left a comment
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.
Looks good with a few last comments.
There are no comments at the platform interface level now though, so go ahead and split that out and we can get it approved and landed!
packages/shared_preferences/shared_preferences/lib/shared_preferences.dart
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences/lib/shared_preferences.dart
Outdated
Show resolved
Hide resolved
.../shared_preferences/shared_preferences/example/integration_test/shared_preferences_test.dart
Outdated
Show resolved
Hide resolved
It's already up and ready, #3497 |
08950c7 to
076d387
Compare
packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart
Outdated
Show resolved
Hide resolved
packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart
Outdated
Show resolved
Hide resolved
|
@stuartmorgan this is ready for final review |
stuartmorgan-g
left a comment
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.
LGTM! 🚢
[shared_preferences] allow custom key prefixes
Allows the use of custom prefixes for all platform (not relevant for windows and linux).
If no custom prefix is supplied, the default prefix
flutter.will be used instead.Fixes flutter/flutter#52544
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.