immutableDiagramValues function
Snapshots JSON-safe values recursively, rejecting cycles, non-finite numbers, non-string map keys and arbitrary objects. Shared by documents and intents. A snapshot previously returned by this function is returned unchanged.
Implementation
Map<String, Object?> immutableDiagramValues(Map<String, Object?> values) {
if (values.isEmpty) return const <String, Object?>{};
if (_frozenCollections[values] ?? false) return values;
final snapshot = _snapshotShapeValue(
values,
HashSet<Object>.identity(),
) as Map<String, Object?>;
_frozenCollections[snapshot] = true;
return snapshot;
}