Package 

Class RememberRiveWorkerKt

    • Method Summary

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

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

      • rememberRiveWorker

        @Composable() final static CommandQueue rememberRiveWorker(Boolean autoPoll)

        A RiveWorker 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 Rive worker is managed by this composable. It will release the resources allocated to the Rive worker when it falls out of scope.

        A Rive worker 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 Rive worker cannot be created. If you want to handle failure gracefully, use rememberRiveWorkerOrNull instead.

      • rememberRiveWorkerOrNull

        @Composable() final static CommandQueue rememberRiveWorkerOrNull(MutableState<Throwable> errorState, Boolean autoPoll)

        A nullable variant of rememberRiveWorker that returns null if the Rive worker cannot be created.

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

        Parameters:
        errorState - A mutable state that holds the error if the Rive worker creation fails.