copyJsonValue method
Creates a detached, deeply immutable copy of any JSON-compatible value.
The value consumes its actual scalar/container nodes and UTF-8 bytes in the shared structured root. It also observes metadata depth, node, entry, and byte limits. Failures are transactional and retain no partial value.
Implementation
Object? copyJsonValue(
Object? value, {
required String field,
bool omitEmbeddedMediaDataUris = false,
}) {
_rejectReentrantMetadataAccess();
_metadataCopyInProgress = true;
try {
return _copyJsonValue(
value,
field: field,
omitEmbeddedMediaDataUris: omitEmbeddedMediaDataUris,
);
} finally {
_metadataCopyInProgress = false;
}
}