Want to copy List
1 2 3 4 5 6 7 8 9 10 11 12 13 |
class MyModal { int myField1; String myField2; List<MyModal> adjacentNodes; MyModal(this.myField1,this.myField2); MyModal.clone(MyModal source) : this.myField1 = source.myField1, this.myField2 = source.myField2, this.adjacentNodes = source.adjacentNodes.map((item) => new MyModal.clone(item)).toList(); } var secondList = originalList.map((item) => new MyModal.clone(item)).toList(); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.