flutter list of objects code example

Example 1: length of array in flutter

fixedLengthList.length

Example 2: add list fromflutter

ListView(
  children: <Widget>[
    ListTile(
      leading: Icon(Icons.map),
      title: Text('Map'),
    ),
    ListTile(
      leading: Icon(Icons.photo_album),
      title: Text('Album'),
    ),
    ListTile(
      leading: Icon(Icons.phone),
      title: Text('Phone'),
    ),
  ],
);

Example 3: flutter count list

var comments = <Comment>[...];
var count = comments.where((c) => c.product_id == someProductId).toList().length;