새로운 리스트를 생성하여 복사할때
List.from()을 이용
기존에 있는 리스트에 복사할때
addAll() 이용
참고
https://codechacha.com/ko/dart-clone-list/
Flutter/Dart - 리스트 복사 방법
리스트 복사, 리스트의 요소들을 다른 리스트에 추가하는 방법을 소개합니다. List.from(list)는 리스트를 생성할 때 list의 모든 요소를 초기 값으로 추가합니다. 아래와 같이 list와 동일 요소를 갖
codechacha.com
728x90
'Flutter' 카테고리의 다른 글
[Flutter] Connecting flutter simulator to localhost api (0) | 2023.01.27 |
---|---|
[Flutter] flutter DateTime parse formatting (0) | 2023.01.27 |
[Flutter] flutter textfield height (0) | 2023.01.17 |
[Flutter] 함수형프로그래밍 List of Maps VS Map of Maps 데이터 접근 (0) | 2023.01.16 |
[Flutter] ReorderableListView (0) | 2023.01.13 |