create

fun create(name: String, platformContext: AiutaPlatformContext): AiutaStorage

Creates or retrieves a storage instance for the given namespace.

The namespace is used to isolate data between different features. Each namespace has its own DataStore file on disk.

On Android, the files are stored in the app's private directory: {filesDir}/datastore/{name}.preferences_pb

On other platforms, platform-specific storage locations are used.

Return

AiutaStorage instance for the given namespace

Parameters

name

Unique namespace identifier (e.g., "size_fit_preferences"). Must be a valid filename (alphanumeric, underscore, hyphen). Must not be empty.

platformContext

Platform-specific context. On Android, this is android.content.Context. On other platforms, use AiutaPlatformContext.INSTANCE.

Throws

if name is empty or contains invalid characters