Skip to content
pubscout

deepcopy

1.1.2, released 3 years ago by letyarch.blogspot.com

Recursive deep copy for nested collections like List, Set, and Map.

WASM-ready
$ flutter pub add deepcopy
Source repository

What it does

Provides an extension method to perform recursive deep copies of nested collections in Dart. Ensures that cloned objects are independent and do not share references with the original objects.

AI-written summary of version 1.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to independently clone nested lists, maps, or sets without shared references.
  • You want an alternative to JSON encoding/decoding for deep copying collections.

Skip it when

  • You are working with custom object models that require specific serialization logic beyond basic collections.

Strengths

  • Simple to use via extensions.
  • Performs recursive deep copies of nested List, Map, and Set collections.
  • No external dependencies.

Weaknesses

  • Limited to standard collection types (List, Set, Map).
  • Some benchmarks for set and map types are not yet fully implemented.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:deepcopy/deepcopy.dart';

List clonedList = originalList.deepcopy();
Map clonedMap = originalMap.deepcopy();
Set clonedSet = originalSet.deepcopy();

Alternatives

Packages that do the same job and could replace deepcopy.