getEntity

abstract suspend fun <T : Any> getEntity(clazz: KClass<T>, id: String): T?

Retrieves a single entity of type T by its id.

Return

The entity or null if not found.

Example:

val user = storage.getEntity(SampleUserProfile::class, "u1")

Parameters

clazz

The KClass of the entity type.

id

The unique identifier of the entity.

Type Parameters

T

The entity type (must be annotated with @Entity).