core library
Core cloning API and contracts for the Cloner library.
This library provides the primary entry point for cloning operations:
- Cloner: Static API with convenience methods and global reference management
- ICloneable: Interface for types that support deep cloning
- ICopyable: Interface for types that support shallow copying
- UnsupportedTypedCloneException: Thrown when typed cloning fails
- CircularReferenceCloneException: Thrown when circular references are detected
- LimitExceededException: Thrown when a cloning operation exceeds a predefined resource or recursion limit
Difference from base.dart:
core.dartexports the high-level Cloner API for most use casesbase.dartexports BaseCloner and ICloning for custom implementations
For most applications, import this library:
import 'package:cloner/core.dart';
final cloned = Cloner.cloneValue(original, doTypedClone: true);
To customize cloning behavior, see base.dart for implementing ICloning.
Classes
- Cloner
- Provides access to the global cloning implementation.
-
ICloneable<
T extends Object> -
Contracts used by
Clonerand collection helpers. -
ICopyable<
T extends Object> - Use for a shallow, element-wise copy.
Exceptions / Errors
- CircularReferenceCloneException
- Thrown when a circular reference is detected during cloning.
- LimitExceededException
- Thrown when some limit is exceeded.
- UnsupportedTypedCloneException
- Thrown when typed cloning encounters an unsupported nested structure.