mmkvWithID

fun MMKV.Companion.mmkvWithID(mmapID: String, mode: MMKVMode = MMKVMode.SINGLE_PROCESS, cryptKey: String? = null): MMKV

Returns (or creates) a named MMKV instance identified by mmapID, wrapped with event dispatching.

  • Uses an internal center map to return the same wrapped instance for the same mmapID.

  • The wrapped instance enables addEventListener notifications for key changes.

Return

The MMKV instance associated with mmapID, enhanced with change notifications.

Parameters

mmapID

The unique identifier of the MMKV instance.

mode

The storage mode for MMKV. Defaults to MMKVMode.SINGLE_PROCESS.

cryptKey

Optional encryption key. Passing null means no encryption.