flutter listview dynamic list code example

Example 1: flutter listview builder

List<String> litems = ["1","2","Third","4"];
body: new ListView.builder
  (
    itemCount: litems.length,
    itemBuilder: (BuildContext ctxt, int index) {
     return new Text(litems[index]);
    }
  )

Example 2: listview inside column flutter

new Column(
  children: <Widget>[
    new Expanded(
      child: horizontalList,
    )
  ],
);

Example 3: dynamic listview to do list flutter

// A Separate Function called from itemBuilderWidget buildBody(BuildContext ctxt, int index) {  return new Text(litems[index]);}body: new ListView.builder(  itemCount: litems.length,  itemBuilder: (BuildContext ctxt, int index) => buildBody(ctxt, index)),

Tags:

Dart Example