Key
A tag for typed data tied to a Lifecycle
You are encouraged to use Lifecycle.createKey as it's easier to type, but you can manually create a key and use it like so:
object DemoKey : ConcurrentScopedData.Key<Int> {
override val lifecycle = SomeLifecycle
}
... later ...
data.start(SomeLifecycle)
data[DemoKey] = 123
Content copied to clipboard