List<dynamic> cloneArray(List<dynamic> array) { // ignore: unnecessary_type_check return (array is List) ? array.sublist(0) : <dynamic>[]; }