fromSource

suspend fun fromSource(source: RiveFileSource, riveWorker: RiveWorker): Result<RiveFile>

Loads a RiveFile from the given source.

⚠️ The lifetime of the RiveFile is managed by the caller. Make sure to call close when you are done with the file to release its resources. The returned file holds a reference to riveWorker, so closing it is required before the worker can fully release memory associated with this file.

Return

The loaded Rive file, or an error if loading failed. The Loading state is not used here since the loading is performed in a suspend function.

Parameters

source

The source of the Rive file.

riveWorker

The Rive worker that owns the file.