-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[shared_preferences] Fix Android type mismatch regression #8512
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,27 @@ class SharedPreferencesPigeonOptions { | |
| bool useDataStore; | ||
| } | ||
|
|
||
| class StringListResult { | ||
| StringListResult({ | ||
| required this.jsonEncodedValue, | ||
| required this.foundPlatformEncodedValue, | ||
| }); | ||
|
|
||
| /// The JSON-encoded stored value, or null if something else was found, in | ||
| /// which case [foundPlatformEncodedValue] will indicate its type. | ||
| String? jsonEncodedValue; | ||
|
|
||
| /// Whether value using the legacy platform-side encoding was found. | ||
| /// | ||
| /// This value is only meaningful if [jsonEncodedValue] is null. | ||
| /// - If true, the value should be fetched with | ||
| /// getPlatformEncodedStringList(...) instead. | ||
| /// - If false, an unexpected string (one without any encoding prefix) was | ||
| /// found. This will happen if a client uses getStringList with a key that | ||
| /// was used with setString. | ||
| bool foundPlatformEncodedValue; | ||
|
||
| } | ||
|
|
||
| @HostApi(dartHostTestHandler: 'TestSharedPreferencesAsyncApi') | ||
| abstract class SharedPreferencesAsyncApi { | ||
| /// Adds property to shared preferences data set of type bool. | ||
|
|
@@ -107,9 +128,9 @@ abstract class SharedPreferencesAsyncApi { | |
| SharedPreferencesPigeonOptions options, | ||
| ); | ||
|
|
||
| /// Gets individual List<String> value stored with [key], if any. | ||
| /// Gets the JSON-encoded List<String> value stored with [key], if any. | ||
| @TaskQueue(type: TaskQueueType.serialBackgroundThread) | ||
| String? getStringList( | ||
| StringListResult? getStringList( | ||
| String key, | ||
| SharedPreferencesPigeonOptions options, | ||
| ); | ||
|
|
||
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.
non blocking nit: would prefer "...DeprecatedStringList" over "Legacy" but this is a test so the consequence is small.
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.
Renamed to the more specific "PlatformEncoded".