Skip to content

[shared_preferences] full api redesign with DataStore and cache-less interface - #5210

Merged
auto-submit[bot] merged 5 commits into
flutter:mainfrom
tarrinneal:spr
Jul 30, 2024
Merged

[shared_preferences] full api redesign with DataStore and cache-less interface#5210
auto-submit[bot] merged 5 commits into
flutter:mainfrom
tarrinneal:spr

Conversation

@tarrinneal

@tarrinnealtarrinneal commented Oct 24, 2023

Copy link
Copy Markdown
Contributor

Full rework for shared_preferences, allows user to decide whether to use cache or be fully async and pull direct from the platform.

fixesflutter/flutter#123078
fixesflutter/flutter#133098
fixesflutter/flutter#65145
fixesflutter/flutter#64739
fixesflutter/flutter#151036

@tarrinnealtarrinneal changed the title first draft[shared_preferences] full api redesignOct 30, 2023
@tarrinnealtarrinneal changed the title [shared_preferences] full api redesign[shared_preferences] full api redesign with cache-less optionOct 30, 2023
@tarrinneal
tarrinneal marked this pull request as ready for review October 30, 2023 23:57
@tmpfs

This comment was marked as off-topic.

@stuartmorgan-g

This comment was marked as off-topic.

@tmpfs

This comment was marked as off-topic.

@stuartmorgan-g

This comment was marked as off-topic.

@tarrinneal
tarrinneal requested review from hellohuanlin and removed request for cyanglazNovember 21, 2023 23:48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider making the java target higher in this rewrite (11 or 17)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the current state of flutter tool enforcement on Java versions? Does the tooling require 11 now, or could someone be using 8?

If the tooling allows 8, I think having shared_preferences require something higher would be extremely disruptive, and we'd want to raise that floor tool-first rather than critical-package-first.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

From offline discussion: It's still 8 at the tooling level for now. Given that, we should hold off, and update to 11/17 after the tool (on stable) has done so.

@hellohuanlin

Copy link
Copy Markdown
Contributor

@tarrinneal do you have a design doc that I can take a look before reviewing it?

@tarrinneal

Copy link
Copy Markdown
ContributorAuthor

@tarrinneal do you have a design doc that I can take a look before reviewing it?

https://docs.google.com/document/d/1DNhUYIJaDA10g2cOqipKyPuPkgL_FYPfgkF9Coqcc6k/edit

Might have changed the design a bit since I wrote it.

@tarrinneal

Copy link
Copy Markdown
ContributorAuthor

We should probably start brainstorming actual names in parallel with the rest of the review. Maybe AsyncSharedPreferences and CachedSharedPreferences?

CachedSharedPreferences seems incorrect. SharedPreferencesWithCache? I'm fine with either.

@tarrinneal

Copy link
Copy Markdown
ContributorAuthor

@stuartmorgan last chance if you want to do another pass on this now that it's just the front end.

Comment threadpackages/shared_preferences/shared_preferences/README.md Outdated
Comment threadpackages/shared_preferences/shared_preferences/README.md Outdated
Comment threadpackages/shared_preferences/shared_preferences/README.md Outdated
Comment threadpackages/shared_preferences/shared_preferences/pubspec.yaml Outdated
Comment threadpackages/shared_preferences/shared_preferences_platform_interface/README.md Outdated
@tarrinneal

Copy link
Copy Markdown
ContributorAuthor

Looks like tests are passing (besides mac flake), going to mark as auto merge!

@tarrinnealtarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
@auto-submitauto-submitBot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
@auto-submit

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/packages/5210, due to - The status or check suite Mac_arm64 ios_platform_tests_shard_1 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@tarrinnealtarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
@auto-submit
auto-submitBot merged commit 644000b into flutter:mainJul 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 31, 2024
auto-submitBot pushed a commit to flutter/flutter that referenced this pull request Jul 31, 2024
flutter/packages@99e8606...46a712f
2024-07-31 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 tarrinneal@gmail.com [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 51940183+Sameri11@users.noreply.github.com [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 tarrinneal@gmail.com [shared_preferences] Platform implementations of async api (flutter/packages#6965)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@xVemu

xVemu commented Aug 1, 2024

Copy link
Copy Markdown
Contributor

setMockInitialValues is missing for SharedPreferencesWithCache

@tarrinneal

Copy link
Copy Markdown
ContributorAuthor

setMockInitialValues is missing for SharedPreferencesWithCache

You can set the cache manually when instantiating SharedPreferencesWithCache so there is no need for that method.

TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
flutter/packages@99e8606...46a712f
2024-07-31 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 tarrinneal@gmail.com [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 51940183+Sameri11@users.noreply.github.com [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 tarrinneal@gmail.com [shared_preferences] Platform implementations of async api (flutter/packages#6965)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
flutter/packages@99e8606...46a712f
2024-07-31 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 tarrinneal@gmail.com [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 51940183+Sameri11@users.noreply.github.com [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 tarrinneal@gmail.com [shared_preferences] Platform implementations of async api (flutter/packages#6965)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…interface (flutter#5210)
Full rework for shared_preferences, allows user to decide whether to use cache or be fully async and pull direct from the platform.
fixesflutter/flutter#123078fixesflutter/flutter#133098fixesflutter/flutter#65145fixesflutter/flutter#64739fixesflutter/flutter#151036
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
…interface (flutter#5210)
Full rework for shared_preferences, allows user to decide whether to use cache or be fully async and pull direct from the platform.
fixesflutter/flutter#123078fixesflutter/flutter#133098fixesflutter/flutter#65145fixesflutter/flutter#64739fixesflutter/flutter#151036
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit Appp: shared_preferences

Projects

None yet

7 participants

@tarrinneal@tmpfs@stuartmorgan-g@hellohuanlin@goderbauer@xVemu@reidbaker