⚠️ This lesson is retired and might contain outdated information.

Building Dynamic Lists in Flutter with ListViews

nader dabit
Instructornader dabit
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 2 years ago

ListView is the most commonly used scrolling widget in a Flutter application. In this video, we'll learn how to create dynamic lists using Flutter's ListView widget to render both lists of Strings & lists of Maps

Instructor: [00:01] We'll begin with the basic material app with the home set to main app. Main app returns a scaffold containing an app bar and a body. In the body of this scaffold, we'd like to render a list of text widgets. We'll first define a variable of people and set it to a list.

[00:34] Next, we'll update the child of the center widget to be a listview.builder. Listview.builder builds the children of the list on demand. The builder constructor is appropriate for list views with a large, unknown, or infinite number of children because the builder is called only for those children that are actually visible.

[00:54] We'll first set the item count to the length of our list. The item builder method will be used to build the items within our list. The item builder method will be called the number of times set as the item count. In the item builder, we'll return a text widget set to the value of the index of the current item in the people array.

[01:34] Next, we'll look at how to render a list of maps. First, we'll update the items in our list to be of type map. Next, in the item builder function, we'll return the people index with the name property. We can also add padding to the list by setting a padding property.

egghead
egghead
~ a minute ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today