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

RevAssetPayload
A compiled script or a fetched asset, under the name RevPayloadPlan gave it.
RevAssetRequest
One fetch an asset of a rev needs. Its bytes become a payload under each of keys, or, for a library, the snapshot under its one key.
RevDocument
A rev our C++ exporter decoded once, planned by revDocumentPayloadSources and then exported through RevToRivRequest, once each, and freed with freeRevDocument. Only an address, so it crosses into an isolate.
RevLibrarySnapshot
A library snapshot a rev imports, under the key its request named.
RevMissingLibrary
A missing library: what the host calls it and the snapshot it names.
RevPayloadPlan
What revToRiv needs its caller to make for a rev, scripts in the order an aggregate signature covers them.
RevScriptSource
A script or shader a rev's riv needs compiled, under the module path RevAssetPayload.name has to carry.
RevToRivRequest
A rev's ship export, as the editor hands RuntimeExporter.export its options. Ids are client:object.
RevToRivResult
The riv, or the errors that stopped it, with what the export left out and the referenced assets to ship beside it.
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.

Enums

RevExportType
The export type every binary asset takes, as RuntimeExporter's exportTypeOverride.

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

decodeRevDocument(Uint8List rev, {String scriptLanguage = '', Map<String, int> externalMappedIds = const {}}) → RevDocument?
Decodes rev once, for revDocumentPayloadSources and then revToRiv. scriptLanguage and externalMappedIds as the export's request names them. Null when the rev does not decode or markupAvailable is false.
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.
freeRevDocument(RevDocument document) → void
revDocumentPayloadSources(RevDocument document) → RevPayloadPlan?
As revPayloadSources, for a document decodeRevDocument decoded.
revDocumentScriptOrder(RevDocument document, {List<RevLibrarySnapshot> libraries = const []}) → List<String>
Links libraries, the snapshots the plan's requests named, into document's export, and returns the payload key of every script and shader it writes, a library's behind its snapshot's key, in the order the riv holds them, which is the order to sign them in.
revPayloadSources(Uint8List rev, {String scope = ''}) → RevPayloadPlan?
What revToRiv needs its caller to make for rev, whose asset keys carry scope when it is a library snapshot. Null when the rev does not decode or markupAvailable is false.
revScriptKey(String modulePath, {String library = ''}) → String
The name the export looks a script or shader's payload up by, as rml's revScriptKey builds it: its module path, behind # and its snapshot's key for a library's. A host path that starts with # doubles it, so no host script can take a library's payload.
revToRiv(RevToRivRequest request) → RevToRivResult
Exports request's rev with the C++ exporter, rml's revToRiv. A request with a RevDocument consumes it, which still needs freeRevDocument.
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.