알쓸전컴(알아두면 쓸모있는 전자 컴퓨터)
Flutter 에서 Widget ReRender 필요시 참고 자료 본문
https://stackoverflow.com/questions/51279611/flutter-listview-builder-not-updating-after-insert
Flutter ListView.builder not updating after insert
I've got a SQLite database that I query data from. From such data I create the necessary widgets and store them in a list. Passing the list to ListView.builder I create the items from the list.
stackoverflow.com
Flutter 에서 Key값을 유지하고 사용하거나 설정을 하지 않으면
위와 같은 문제가 발생할수 있다.
데이터 업데이트가 Widget에 반영이 안되거나 이상하게 순서가 안맞는경우
다시 그려줘야 하는데 key값 변경 시켜 데이터 까지 다시 반영하여 instance를 생성하게 해줘야 한다.
좀더 상세한 내용
아래 블로그에 자세히 나와 있습니다.
[Flutter] Key란 무엇인가?
기본적으로 플러터의 위젯은 생성자에서 Key매개변수를 받을 수 있습니다. 하지만 그렇게 많이 사용되지는 않습니다. 위젯이 위젯트리에서 위치를 변경하더라도 Key는 상태정보를 유지합니다. ��
nsinc.tistory.com
'Flutter,Dart' 카테고리의 다른 글
Flutter 강의 추천 (0) | 2020.05.30 |
---|---|
Flutter Android 생명 주기 리턴 받기 (0) | 2020.05.26 |
Json 을 Dart 코드로 변환 하기 (0) | 2019.10.28 |
flutter androidx migration 후 바로 꺼질때 (0) | 2019.10.23 |
Flutter Execution failed for task ':firebase_core:verifyReleaseResources' 에러 (1) | 2019.10.23 |
Comments