rive_markup library

Rive markup (.rml) conversion backed by packages/rml. Editor-only: the native symbols are excluded from flutter_runtime builds, so this library must never be imported from runtime code paths.

Classes

RmlCommitDiff
The outcome of diffing a sandbox markup document against its base (rmlCommitDiff): either errors from compiling one of the two documents, or a classified change set ready to apply to the live file.
RmlCommitEntry
One create, update or remove rmlCommitDiff reports, describing one of changes.objects in the same order.
RmlCommitRequire
forKey 0: the whole entry needs unit; otherwise only its update of forKey does. Read from the report's "requires" list, whose "for" field is omitted (and so defaults to 0) when it applies to the whole entry.
RmlCommitSkip
One change rmlCommitDiff left out of the commit: an object not created/removed, or (when key is non-zero) one property of an update.
RmlCompileError
One error rmlToRev reported: the compiler's own, or one added for a file= this binding could not embed.
RmlCompileResult
The outcome of compiling a markup document into .rev bytes: exactly one of bytes and errors is set.
RmlExportedFile
A file an export split out of the markup. bytesOmitted files only name an asset: bytes is empty and the real bytes live elsewhere.
RmlExportedProject
A .rev exported as main.rml's markup plus the files it references with file=: a script or shader per file, and a byteless file per binary asset.
RmlFileInput
One file of a project handed to the compiler. Null bytes means the file exists but its bytes are withheld: a binary asset naming it compiles without contents.
RmlFileReference
An asset element's file=, as the compile resolved it.
RmlOrderGroup
A run of siblings under one property key that need a live order value. A root group is not scoped to a parent (parent is meaningless): its members are creates whose key no parent group orders, every order key of a new root among them, placed after every live value of key.
RmlProblem
Something rml's inspect found wrong with a document: the compiler accepts it, but it is wired to the wrong thing.
RmlProjectCompileResult
The outcome of compiling a project: exactly one of bytes and errors is set. fileReferences is set whenever the compile ran, failed or not.

Properties

markupAvailable → bool
Whether the loaded native library carries the markup symbols. False in flutter_runtime builds, where rml is excluded (editor-only); callers (and tests) must check before using revToRml or rmlToRev -- the lazily-initialized lookups below throw on first use otherwise. Every markup symbol is probed: they come from one translation unit, so a library carrying only some of them is a stale build, and failing closed sends callers down their fallback instead of throwing.
final

Functions

decodeRmlExportedFiles(Uint8List bundle) → List<RmlExportedFile>
Decodes the bundle an export returns. Throws a FormatException when the bundle is cut short or runs past its last file.
encodeRmlFileInputs(List<RmlFileInput> files) → Uint8List
Encodes files for the compiler. A file with null bytes is withheld.
revToRml(Uint8List revBytes) → Uint8List?
Converts the bytes of a .rev file into the equivalent .rml markup document, with every payload embedded. Returns null when the bytes are not a readable .rev.
revToRmlFiles(Uint8List revBytes) → RmlExportedProject?
Converts the bytes of a .rev file into main.rml's markup plus the files it references with file=: scripts and shaders with their source, binary assets as byteless files that only name them. Returns null when the bytes are not a readable .rev or markupAvailable is false.
rmlCommitDiff(String base, String sandbox, {required int client, required int firstObject}) → RmlCommitDiff
Diffs a sandbox markup document against its base, both compiled here: the result classifies every change into a ChangeSet the live file can apply, remapping new objects from (client, firstObject). When markupAvailable is false, or base or sandbox is empty, it returns a failure without calling native; an empty base is the base's failure. A negative client or firstObject throws an ArgumentError.
rmlCommitDiffFiles({required String base, required List<RmlFileInput> baseFiles, required String sandbox, required List<RmlFileInput> sandboxFiles, required int client, required int firstObject}) → RmlCommitDiff
rmlCommitDiff over projects: base compiles against baseFiles and sandbox against sandboxFiles. A file with null bytes is withheld, so an asset naming it diffs as unchanged without either side holding its bytes. When markupAvailable is false, or base or sandbox is empty, it returns a failure without calling native, and ids are checked, as in rmlCommitDiff.
rmlInspect(String rml) → List<RmlProblem>
Problems rml's inspect finds in a single RML document: the compiler accepts these but they are wired wrong. Treats rml as one document -- no fragments, default InspectOptions.
rmlSchemaDescribe(String typeName, {bool includeEditorOnly = false, bool animatableOnly = false, bool bindableOnly = false, bool json = false}) → String?
A core type's properties, inherited included: the same answer rive schema <typeName> gives. Null for a type that does not exist -- json does not change that, an unknown type is empty either way.
rmlSchemaSearch(String text, {bool json = false}) → String
Types and properties whose names contain text, case-insensitively: the same answer rive schema --search <text> gives. Empty when nothing matches -- including an empty text, which the CLI never passes through to a search either.
rmlSchemaTypes({bool json = false}) → String
Every authorable core type name: the same answer rive schema --list gives.
rmlToRev(Uint8List rmlBytes) → RmlCompileResult
Compiles a .rml markup document into the equivalent .rev bytes -- the inverse of revToRml. Every payload the document needs must be embedded in it: a file= reference has no directory to resolve against here and compiles as an error.
rmlToRevFiles(String rml, List<RmlFileInput> files) → RmlProjectCompileResult
Compiles rml against files: text files are served as they are, and a file with null bytes is present but compiles without contents. A file= the list does not hold is an error naming the asset and path. When markupAvailable is false, it returns a failure without calling native.