shared_preferences_ios_sn 1.0.1 copy "shared_preferences_ios_sn: ^1.0.1" to clipboard
shared_preferences_ios_sn: ^1.0.1 copied to clipboard

outdated

Simply to wrap the Flutter plugin shared_preferences plugin and provide iOS "suite name" feature

shared_preferences_ios_sn #

Wraps Flutter shared_preferences plugin, providing a iOS Suite Name support, it's helpful for sharing data from App to Widget.

Why Need "Suite Name" Feature? #

When you need to share your data from your App to Widget

Usage #

in pubspec.yaml: #

shared_preferences_ios_sn: ^1.0.0

#shared_preferences: x.x.x //should comment 'shared_preferences' 

and just run the follow command to install the plugin:

flutter pub get

in Flutter code: #

//final prefs = SharedPreferences.getInstance();

//use this to instead of above, prefs will works like a normal SharedPreferences instance in many different platforms.
final prefs = await SPUtil.withSuitName("<Your iOS GROUP NAME>");
prefs.setString("test_key", "test_value");

in Widget swift code: #

//now you can get the SharedPreferences data from App in your widget code, for example:
//dont forget to add prefix "flutter." to the key:
print("test_key:",UserDefaults(suiteName: "<Your iOS GROUP NAME>")?.string(forKey: "flutter.test_key"))

5
likes
0
pub points
71%
popularity

Publisher

unverified uploader

Simply to wrap the Flutter plugin shared_preferences plugin and provide iOS "suite name" feature

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, meta, shared_preferences, shared_preferences_platform_interface

More

Packages that depend on shared_preferences_ios_sn