-
Notifications
You must be signed in to change notification settings - Fork 0
Multi Process Access
Sudhi S edited this page Jul 28, 2026
·
1 revision
By default both stores are single-process and are not safe to touch from
more than one process at a time. If a background service (Android) or an app
extension (iOS) needs the same data, opt in once at startup with
configure — it's non-destructive and leaves the default store untouched.
// Regular store
await NativeDatastore().configure(
multiProcess: true, // Android: MultiProcessDataStore
appGroupId: 'group.com.you.app', // iOS: shared App Group (UserDefaults)
);
// Secure store (same signature)
await SecureDatastore().configure(
multiProcess: true, // Android: multi-process encrypted store
appGroupId: 'TEAMID.com.you.shared', // iOS: Keychain access group
);Android (multiProcess: true) |
iOS (appGroupId) |
|
|---|---|---|
| Regular |
MultiProcessDataStore in its own file |
UserDefaults(suiteName:) App Group |
| Secure | Encrypted MultiProcessDataStore (native_datastore_secure_mp.json) |
appGroupId used as the Keychain access group
|
-
Separate file on Android. The multi-process store uses its own file, so
values in the default single-process store are not migrated into it. Set
configurebefore your first read/write. -
iOS
appGroupIdmeans different things per store. For the regular store it's an App Group suite name (e.g.group.com.you.app, App Groups capability). ForSecureDatastoreit's a Keychain access group (often team-prefixed, e.g.$(AppIdentifierPrefix)com.you.shared, Keychain Sharing capability). They are different strings — you can't pass the same value to both. - Enable the capability in Xcode (App Groups and/or Keychain Sharing) for iOS sharing to work.
Only if your app runs code in a separate process / extension. Symptoms of
multi-process misuse on the default store: silently lost writes, "old" values
reappearing after upgrade, or CorruptionException. If everything runs in the
main Flutter process, you don't need configure.
Full write-up: Multi-process access.
native_datastore