Package 

Class RememberCommandQueueKt

    • Method Summary

      Modifier and Type Method Description
      final static CommandQueue rememberCommandQueue() A CommandQueue is the worker that runs Rive in a thread.
      final static CommandQueue rememberCommandQueueOrNull(MutableState<Throwable> errorState) A nullable variant of rememberCommandQueue that returns null if the command queue cannot be created.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • rememberCommandQueue

        @Composable() final static CommandQueue rememberCommandQueue()

        A CommandQueue is the worker that runs Rive in a thread. It holds all of the state, including assets (images, audio, and fonts), RiveFiles, artboards, state machines, and view model instances.

        The lifetime of the command queue is managed by this composable. It will release the resources allocated to the command queue when it falls out of scope.

        A command queue needs to be polled to receive messages from the command server. This composable creates a poll loop that runs while the Lifecycle is in the Lifecycle.State.RESUMED state. The poll rate is once per frame, which is typically 60 FPS.

        This function throws a RuntimeException if the command queue cannot be created. If you want to handle failure gracefully, use rememberCommandQueueOrNull instead.

      • rememberCommandQueueOrNull

        @Composable() final static CommandQueue rememberCommandQueueOrNull(MutableState<Throwable> errorState)

        A nullable variant of rememberCommandQueue that returns null if the command queue cannot be created.

        Use this variant if you want to handle the failure of command queue creation gracefully, which may be desirable in production.

        Parameters:
        errorState - A mutable state that holds the error if the command queue creation fails.