Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between SliverList vs ListView in Flutter

What are the differences between SliverList and ListView in Flutter?

like image 324
Rafiqul Hasan Avatar asked May 16 '18 09:05

Rafiqul Hasan


People also ask

What is the difference between ListView and SingleChildScrollView?

For example: You need to only show a list of contacts on your screen and the list items are more or less similar (UI wise and category wise). Then you would use a Listview. A SingleChildScrollView can be compared to "ScrollView" in Android.

What is the difference between ListView and ListView builder?

builder takes properties similar to ListView but has two special parameters known as itemCount and itemBuilder .

What can I use instead of ListView in flutter?

ListView is a very important widget in a flutter. It is used to create the list of children But when we want to create a list recursively without writing code again and again then ListView. builder is used instead of ListView.

How many types of ListView are there in flutter?

4 Types Of ListView In Flutter You Should Know.


1 Answers

There's almost no difference.

ListView is a SliverList. Same with GridView, which is a SliverGrid.

They are doing exactly the same thing. The only difference between them is that SliverList is a sliver, not a widget. Which means it's used inside a ScrollView, usually CustomScrollView.

ListView is nothing else but a biding of SliverList to transform it into a Widget to make it usable alongside other widgets such as Row/Container.


Most of the time, use ListView.

But if you want advanced scroll behavior such as appbar animations with scroll ; you'll need to use a CustomScrollView. Which will force you to use SliverList instead of ListView.

like image 141
Rémi Rousselet Avatar answered Oct 02 '22 03:10

Rémi Rousselet