Android
public class MutableRemoteInt
internal constructor(
constantValueOrNull: Int? = null,
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
internal override val cacheKey: RemoteStateCacheKey,
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
internal val idProvider: (creationState: RemoteComposeCreationState) -> Long,
) :
RemoteInt(
constantValueOrNull = constantValueOrNull,
arrayProvider = { creationState ->
val id =
creationState.getOrPutVariableId(cacheKey) {
Utils.idFromLong(idProvider(creationState)).toInt()
}
longArrayOf(id.toLong() + 0x100000000L)
},
),
MutableRemoteState<Int>
A mutable implementation of RemoteInt.
Secondary Constructors
internal constructor(
id: Long
) : this(
constantValueOrNull = null,
cacheKey = RemoteStateIdKey(id.toInt()),
idProvider = { _ -> id },
)
Constructor for MutableRemoteInt that allows specifying an initial ID.
Parameters
| id | An explicit ID for this mutable integer. |
Companion Object
Methods
createMutable
Android
public fun createMutable(initialValue: Int): MutableRemoteInt
Creates a new mutable state (allocates an ID).
Parameters
| initialValue | The initial value for the state. |
Returns
| A new MutableRemoteInt instance. |