ListView vs ListView.builder 차이점

Jooni·2020년 11월 4일
0

ListView

ListView: Creates a scrollable, linear array of widgets from an explicit List. This constructor is appropriate for list views with a small number of children because constructing the List requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible.

ListView.Builder

ListView.builder Creates a scrollable, linear array of widgets that are created on demand. This constructor is appropriate for list views with a large (or infinite) number of children because the builder is called only for those children that are actually visible.

공통점 :

스크롤이 가능한 배열형 위젯.

다른점:

ListView: 이 위젯이 생성될시 리스트뷰안의 차일드를 모두 생성해서 보여준다. 그래서 소수의 차일드를 가질 경우 쓰는것이 적정하다 ->메뉴리스트 같은??

ListView.Builder: 이 위젯은 LazyList(란?)방식이다. 그때그때 필요할 때 파일을 저장소나 서버에서 불러온다. 그러므로 다량의 파일을 불러올 때 이것을 쓰면 좋다. 이스타그램을 실행했을 때 전세계인의 모든 피드를 불러온다면 모바일폰은 폭발할 것이다. 하지만 이 위젯을 쓰면 보는 부분만 파일들을 불러오기 때문에 콜을 효율적으로 할 수 있다.

profile
이해가 안돼시거나 질문이 있으신 분들은 댓글로 남겨주세요. 성심성의껏 응하겠습니다!

0개의 댓글