revPayloadSources function
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.
Implementation
RevPayloadPlan? revPayloadSources(Uint8List rev, {String scope = ''}) {
if (!markupAvailable || rev.isEmpty) {
return null;
}
final scopeBytes = utf8.encode(scope);
final source = calloc<Uint8>(rev.length);
final scopeSource = calloc<Uint8>(scopeBytes.length + 1);
final response = calloc<_RmlExportResponseStruct>();
try {
source.asTypedList(rev.length).setAll(0, rev);
scopeSource.asTypedList(scopeBytes.length).setAll(0, scopeBytes);
final ok = _revPayloadSources(
source,
rev.length,
scopeSource,
scopeBytes.length,
response,
);
return ok ? _plan(response) : null;
} finally {
_freeRmlExport(response);
calloc.free(response);
calloc.free(scopeSource);
calloc.free(source);
}
}