Class

MutableRemoteString

An implementation of RemoteString that holds its value in a [MutableState].

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public class MutableRemoteString
internal constructor(
    @get:Suppress("AutoBoxing") public override val constantValueOrNull: String?,
    internal override val cacheKey: RemoteStateCacheKey,
    private val lazyRemoteString: LazyRemoteString,
) : RemoteString(), MutableRemoteState<String>

An implementation of RemoteString that holds its value in a [MutableState].

Secondary Constructors

reserveTextId

internal constructor(
    id: Int
) : this(
    constantValueOrNull = null,
    cacheKey = RemoteStateIdKey(id),
    lazyRemoteString =
        object : LazyRemoteString {
            override fun reserveTextId(creationState: RemoteComposeCreationState) = id

            override fun computeRequiredCodePointSet(
                creationState: RemoteComposeCreationState
            ) = null
        },
)

Create a MutableRemoteString from an existing id.


reserveTextId

internal constructor(
    value: String
) : this(
    constantValueOrNull = null,
    cacheKey = RemoteStateInstanceKey(),
    lazyRemoteString =
        object : LazyRemoteString {
            override fun reserveTextId(creationState: RemoteComposeCreationState) =
                creationState.document.addText(value)

            override fun computeRequiredCodePointSet(
                creationState: RemoteComposeCreationState
            ) = null
        },
)

Create a MutableRemoteString for a default value.

Companion Object

Methods


createMutable

Android
public fun createMutable(initialValue: String): MutableRemoteString

Creates a new mutable state (allocates an ID).

Parameters

initialValue The initial value for the state.

Returns

A new MutableRemoteString instance.