Skip to content

[shared_preferences] Consider allowing access to SharedPreferences in the new API #153300

@stuartmorgan-g

Description

@stuartmorgan-g

Based on discussion in #153293 there is a thorny use case we didn't consider in switching the backend from SharedPreferences to DataStore on Android: some external systems that app developers don't control (a notable example from that issue is GDPR consent data docs, more docs) write important information directly to SharedPreferences.

Supporting the legacy API forever is not ideal, especially given issues like #151036 that make use cases like this one troublesome with the legacy API. We could consider making the backing store a configuration option on Android. That would mean fully supporting both systems indefinitely though, even though for most use cases the docs seem to strongly discourage use of SharedPrefences.

Another option would be an alternate API—probably just exposed as a sidecar in shared_preferences_android rather than plumbed through to the app-facing package—that provides async-only, read-only access to SharedPreferences for this specific use case.

The Android team should weigh in here on how we want to support this. Also /cc @tarrinneal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listp: shared_preferencesPlugin to read and write Shared Preferencespackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions