Skip to content

Allow setting prefix in shared preference - for migrating from old app that did not use flutter #52544

@RudolfVonKrugstein

Description

@RudolfVonKrugstein

Use case

I have an app (based on Xamarin, but I that's not importing) that I am migrating to flutter.

The App uses share preferences (NSUserDefaults (on iOS) and SharedPreferences (on Android)) to store some user configuration data.

It would be very nice, if these settings are not lost when migrating to flutter.

But they are (at least in my tests), and I think that is because flutter uses the 'flutter.' prefix for any preferences one stores.

Proposal

Add an option to the shared preference plugin to change the ".flutter" prefix to something else (or even make it empty).

This could be simply done by making the _prefix memeber non-const and adding a static function to change it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: shared_preferencesPlugin to read and write Shared Preferencespackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions