registerValue

Registers the value provider.

There are could be multiple providers registered for the same key. In this case the order in which they were registered matters.

Say we registered two values for the key. One provides "1", second provides "2". this case will have listOf("1", "2) as a value for the key in the underlying map. And later, when the registry will be recreated with the previously saved values, the first execution of consumeValue would consume "1" and the second one "2".

Return

the registry entry which you can use to unregister the provider

Parameters

key

Key to use for storing the value

valueProvider

The value to provide