Why do we use a Reverse property in a Listview?

 

Reversed a list with Listview Builder widget

ListView.builder(
        reverse: true,
        itemCount: 20,
        padding: const EdgeInsets.only(top: 10, bottom: 10),
        itemBuilder: (context, index) {
          return Text(index.toString(),
              textAlign: TextAlign.center,
              style: const TextStyle(fontSize: 25));
        },
      )

 

Reverse property in a Listview

Reverse a list with reversed function

List<String> animals = ['cat', 'dog', 'duck'];
List<String> reversedAnimals = animals.reversed.toList();

 

 

 

Leave a Comment