buildSubscriptionKey

fun <T> buildSubscriptionKey(id: SubscriptionId<T> = SubscriptionId.auto(), subscribe: SubscriptionReceiver.() -> Flow<T>): SubscriptionKey<T>

Function for building implementations of SubscriptionKey using Kotlin Delegation.

Note: By implementing through delegation, you can reduce the impact of future changes to SubscriptionKey interface extensions.

Usage:

class UserSubscriptionKey(private val userId: String) : SubscriptionKey<User> by buildSubscriptionKey(
id = Id(userId),
subscribe = { ... }
)