Flutter ListView.custom constructor - Performance optimized ListView in Flutter

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to flutter teacher we already covered different Constructors of listview class in this session we will deep dive in list view dot custom Constructor so without wasting time let's get started [Music] what is list custom it is the name Constructor from listview class which creates scrollable list of widgets it takes sleeper child delegate which provides the ability to customize the additional aspects of child model for example sleeper child delegate can control the algorithm used to estimate the size of children that are not currently visible on the screen it allows developers to Define custom sleeper layout for list view widget which is more flexible and efficient way of rendering large data sets Constructor suppose we have a list of thousand items that needs to be displayed in a list View and each item contains complex layout with different sizes and shapes rather than using list.builder to create list of explicit widget you can use list2.custom to define custom sliver layout that can efficiently render the complex list items we mostly with this Constructor when children are not known at compile time and when list is nested inside another list overall list2.custom is more flexible and Powerful alternative to list2. Builder Constructor which can provide significant performance benefits in certain scenarios such as when entering large data sets with complex layouts how to use this Constructor children delicate is a required probability in this Constructor that takes sleeper child delegate which makes it different than other Constructors of liquid glass sliver child delegate is optimized for performance and allows you to create large list or grid of children widget without impacting the performance of application basically slavery child delegate is an abstract class that defines the interface for creating and laying out child widget within a sliver sliver child list delegate and civil child Builder delegate are most common concrete classes for sliver child delegate all the remaining properties of listed or custom are similar to that of other Constructors of list to class we already covered them in the list video if you want to learn them please check out the video link is there in the description now let's talk about this sliver child list indicator it is used when we have a fixed list of children widgets that do not change it takes a list of widget as the original parameter that creates and layouts each widget based on the layout constraints of this labor you can see here for this sliver child list delegate I have passed the list of widgets here using the function called Date item gate item is our own function which I have defined here that takes the index of element and it will simply create the box with blue color using this container and some property drop so I don't want to focus on the design part my intention is to just explain how this sliver child release delegate works and there are so many properties here you can see like say I had automatic keep alive rep in boundaries as the semantics index and all the remaining things here the most important thing that you should understand is the position parameter which is actually the list and that takes the list of wages now let's understand this level child Builder delegate we use this when we have Dynamic list of child widget that may change it takes a builder function you can see here and which is the positional parameter that creates the child widgets as needed based on the index it allows you to create large number of child widgets without creating all the items at once which can improve the performance of course now in order to have a dynamic list of items I have a class called user and using this user I have a defined a list of users that has the name their profession and its image you can see here I have imported this file in our code and in order to use that uh your list of user here we simply have these listed custom and here I'm using the sleever child Builder delegate and as we know it requires the Builder function so I have this buildup function here obviously it takes the build context and index here you can see here it also has a parameter that allows us to define the count using the child count and here I'm using the users.length so that I can create all the elements with respect to the number of elements in that users list here and you can see here simply I'm returning release style that creates this image uh the name of this user and simply the profession okay it is just a part of the simple UI here so if I scroll here you can see I'm getting all the elements here that's it for this video see you guys in the next video If you really found this video helpful and knowledgeable then don't forget to like share subscribe and hit the Bell notification button to get my latest videos
Info
Channel: Flutter Teacher
Views: 3,774
Rating: undefined out of 5
Keywords: flutter listview.custom constructor, Flutter ListView.custom Constructor explained, Flutter ListView.custom, Flutter ListView.custom Constructor tutorial, How to use ListView.custom in Flutter, Mastering ListView.custom in Flutter, why to use ListView.custom, Optimizing performance with ListView.custom, what is Listview.custom in Flutter, listview.custom kai hai, flutter optimized listview, how to use ListView.custom constructor, Flutter listview, listview constructors
Id: EmhGG7EQJWs
Channel Id: undefined
Length: 5min 8sec (308 seconds)
Published: Sun Jun 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.