Am having an empty list which am using to hold objects after which am adding the objects to a new key in a map, which is working fine. My problem comes in when I now clear the list, this operation also clears the already added values in the map object. While am supposed to set the list empty to hold other values.

 List<Time> _myTimeSlots = [];
 Map<String, dynamic> selectedValues = {};

onSelected (Time item, index, isSelected) {
        if (isSelected) {
          _myTimeSlots.add(item); 

        } else {
          _myTimeSlots.remove(item);

        }
      },

  void onSave(BuildContext context,
      {required String day}){
            Map<String, dynamic> mapVal = {day: _myTimeSlots};
            selectedValues.add(mapVal);
            _myTimeSlots.clear() //===> *problem comes in here*

}

The first function onSelected am calling it after multiple selection of Time objects of a particular day the onSavefunction am calling it after completing selection now to add entries to the final Map of days and time selections. NOTE Each day has its own list of time in the map object. Any help will be appreciated.