shared_preference_app_group
2.1.0, released 6 months ago by paaatrick.com
Shared preferences for iOS and macOS App Groups using NSUserDefaults.
What it does
Provides access to NSUserDefaults-backed shared preferences for iOS and macOS App Groups, allowing data sharing between an app and its extensions or other related apps. Supports storing and retrieving basic primitive types and string lists.
AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to share simple key-value data between an iOS or macOS app and its App Group extensions (like widgets)
- You specifically need to target iOS and macOS using suite names via NSUserDefaults
Skip it when
- You are building a cross-platform app requiring Android, Web, or Windows support (use shared_preferences instead)
- You need complex querying, relational data, or encryption
Strengths
- Enables seamless data sharing across iOS and macOS App Groups
- Supports Swift Package Manager and CocoaPods
Weaknesses
- Limited to iOS and macOS platforms
- Requires manual native entitlements and App Sandbox configuration
Setup
- Kind
- Plugin (native code)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 0
On macOS, the app must use the App Sandbox capability and list the group identifier under com.apple.security.application-groups in its .entitlements file.
await SharedPreferenceAppGroup.setAppGroup(appGroupID);
await SharedPreferenceAppGroup.setBool('MY_BOOL_KEY', true);
bool boolValue = await SharedPreferenceAppGroup.getBool('MY_BOOL_KEY') ?? false;Alternatives
Packages that do the same job and could replace shared_preference_app_group.
- shared_preferences
If you need general key-value storage across multiple platforms like Android and iOS rather than specifically iOS/macOS App Groups.
97Compare