copyOf function Null safety

dynamic copyOf(
  1. dynamic input
)

Implementation

dynamic copyOf(dynamic input) {
  if (input is Iterable) {
    return List.from(input);
  } else if (input is Map) {
    return Map.from(input);
  } else {
    throw Exception('type could not be copied');
  }
}