HashedCloner class base

Cloner with circular reference detection.

Uses HashMap<int,int> to track hash codes of traversed collections to prevent infinite recursion when encountering circular references. Throws CircularReferenceCloneException if a circular reference is detected during cloning.

DAG note: shared references at the same nesting level will not throw, but repeated references at different nesting levels will be treated as circular.

Use when deep-cloning structures that may contain cycles.

Inheritance
Implemented types

Constructors

HashedCloner({required bool doTypedClone})
Creates a HashedCloner with the specified cloning mode.

Properties

doTypedClone bool
Enables typed cloning for collections when true.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

builder() IClonerBuilding
Returns a builder for constructing a BaseCloner instance.
override
cloneList<E>(List<E> source) List<E>
Deep-clones a List with circular reference detection.
override
cloneMap<K, V>(Map<K, V> source) Map<K, dynamic>
Deep-clones an untyped Map<K, dynamic> with circular reference detection.
override
cloneMapTyped<K, V>(Map<K, V> source) Map<K, V>
Deep-clones a typed Map<K, V> with circular reference detection.
override
cloneSet<E>(Set<E> source) Set<E>
Deep-clones a Set with circular reference detection.
override
cloneValue(dynamic source) → dynamic
Deep-clone source when possible.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Clears all tracked hash codes and resets the cloner state.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited