CountedCloner class base
Extends BaseCloner with enforced recursion and size limits. The lightest way to prevent StackOverflow for circular references.
Counters are not reset between clone operations unless resetCounters is called.
- Inheritance
-
- Object
- BaseCloner
- CountedCloner
- Implemented types
Constructors
- CountedCloner({required bool doTypedClone, int sizeLimit = SIZE_LIMIT_DEFAULT, int nestLimit = NEST_LIMIT_DEFAULT})
- Constructs a CountedCloner with optional size and nesting limits. Limits the total number of cloned values and the maximum recursion depth.
Properties
- doTypedClone → bool
-
Enables typed cloning for collections when true.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- nestLimit → int
-
Maximum allowed nesting depth for recursive cloning.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sizeLimit → int
-
Maximum number of values allowed to be cloned.
final
Methods
-
builder(
) → IClonerBuilding -
Returns a builder for constructing an CountedCloner instance.
override
-
cloneList<
E> (List< E> source) → List<E> -
Clones a
Listwith enforced nesting depth limit.override -
cloneMap<
K, V> (Map< K, V> source) → Map<K, dynamic> -
Clones a
Mapwith dynamic values, enforcing nesting depth limit.override -
cloneMapTyped<
K, V> (Map< K, V> source) → Map<K, V> -
Clones a typed
Mapwith enforced nesting depth limit.override -
cloneSet<
E> (Set< E> source) → Set<E> -
Clones a
Setwith enforced nesting depth limit.override -
cloneValue(
dynamic source) → dynamic -
Wrapper for BaseCloner.cloneValue implementation
with enforced size and nesting limits.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void -
Resets internal counters for size and nesting limits.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- NEST_LIMIT_DEFAULT → const int
- Default nesting depth limit (inclusive).
- SIZE_LIMIT_DEFAULT → const int
- Default size limit for cloned values (1024^2, inclusive).