copyMetadata method
Implementation
Map<String, Object?> copyMetadata(Object? value, {required String field}) {
_rejectReentrantMetadataAccess();
if (value == null) return Map<String, Object?>.unmodifiable(const {});
if (value is! Map) {
throw FormatException(
'Invalid $_resource $field: expected a JSON object.',
);
}
_metadataCopyInProgress = true;
try {
return _copyJsonValue(value, field: field) as Map<String, Object?>;
} finally {
_metadataCopyInProgress = false;
}
}