How do I combine two lists in Dart?

前端 未结 8 886
有刺的猬
有刺的猬 2021-01-31 00:46

I was wondering if there was an easy way to concatenate two lists in dart to create a brand new list object. I couldn\'t find anything and something like this:

My list:

8条回答
  •  青春惊慌失措
    2021-01-31 01:38

    If you want to merge two lists and remove duplicates could do:

    var newList = [...list1, ...list2].toSet().toList(); 
    

提交回复
热议问题