fengdai
05/25/2022, 6:27 AM@Stable
?
The interface is defined like this:
interface SomeState {
val propertyA: NonStableTypeA
val propertyB: NonStableTypeB
}
And in the implementation class, all public properties are backed by MutableState
:
internal class SomeStateImpl: SomeState {
override var propertyA: NonStableTypeA by mutableStateOf(...)
internal set
override var propertyB: NonStableTypeB by mutableStateOf(...)
internal set
}
myanmarking
05/25/2022, 8:55 AMfengdai
05/25/2022, 9:21 AM```* When applied to a class or an interface, [Stable] indicates that the following must be true:
*
* 1) The result of [equals] will always return the same result for the same two instances.
* 2) When a public property of the type changes, composition will be notified.
* 3) All public property types are stable.```Since some of its public property types are unstable, so the interface itself is also unstable.
SomeStateImpl
is stable. But since it also implements another interface for internal usage, I don’t want to expose it directly.Albert Chang
05/25/2022, 10:26 AM@Composable
fun SomeFun(state: SomeState)
If you have a composable like this, actually the stabilities of `SomeState`’s implementations are irrelevant here. The metrics of the function will solely depend on the stability of the interface itself.Zach Klippenstein (he/him) [MOD]
05/25/2022, 3:06 PM@Stable
on an interface isn't just a contract for consumers, it's also a contract to all implementers is they must also ensure they are stable.