deepClone function

dynamic deepClone(
  1. dynamic _in
)

This assumes that the data coming in is a map, list, or primitive (json).

Implementation

dynamic deepClone(final _in) {
  if (_in is Map) {
    return deepCloneMap(_in);
  } else if (_in is Iterable) {
    return deepCloneList(_in);
  } else if (_in is MapModel) {
    return deepClone(_in.wrapped);
  } else if (_in is bool) {
    return _in;
  } else if (_in is String) {
    return _in;
  } else if (_in is num) {
    return _in;
  } else if (_in == null) {
    // okay... return it
    return _in;
  } else {
    illegalState("Bad argument type $_in -> ${_in.runtimeType}");
  }
}