deepCopy<T> function
T?
deepCopy<T>(
- T? o
Deeply copies o
.
Implementation
T? deepCopy<T>(T? o) {
if (o == null) return null;
if (o is String) return o;
if (o is num) return o;
if (o is bool) return o;
if (o is Set) return deepCopySet(o) as T?;
if (o is List) return deepCopyList(o) as T?;
if (o is Iterable) return deepCopyList(o.toList(growable: false)) as T?;
if (o is Map) return deepCopyMap(o) as T?;
var entityHandler =
EntityHandlerProvider.globalProvider.getEntityHandler(obj: o);
if (entityHandler != null) {
// ignore: discarded_futures
var o2 = entityHandler.copy(o);
if (o2 is! Future) {
return o2 ?? o;
}
}
return o;
}