No need to clear before assignment. Given that and the above, the whole function becomes:\
   
    void setSelection(List<Resource> resources) => _treeView.selection = resources.map((r) => r.uuid);