Class

MutableRemoteFloat

A mutable implementation of RemoteFloat.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public class MutableRemoteFloat
internal constructor(
    internal override val cacheKey: RemoteStateCacheKey,
    private var idProvider: (creationState: RemoteComposeCreationState) -> Float,
) : RemoteFloat(), MutableRemoteState<Float>

A mutable implementation of RemoteFloat. It also implements [MutableRemoteState].

Secondary Constructors

internal constructor() :
    this(
        cacheKey = RemoteStateInstanceKey(),
        idProvider = { creationState -> creationState.document.reserveFloatVariable() },
    )
internal constructor(
    id: Int
) : this(cacheKey = RemoteStateIdKey(id), idProvider = { asNan(id) })
internal constructor(
    initialValue: Float
) : this(
    cacheKey = RemoteStateInstanceKey(),
    idProvider = { creationState -> creationState.document.addFloatConstant(initialValue) },
)

Companion Object

Methods

createMutable

Android
public fun createMutable(initialValue: Float): MutableRemoteFloat

Creates a new mutable state (allocates an ID).

Parameters

initialValue The initial value for the state.

Returns

A new MutableRemoteFloat instance.