How to reverse listview in Flutter

Issue

I implemented a listview which get data from a json.

I followed this implementation.

How could i reverse the order of this listview? (The first element should became the last, ecc…).

Solution

You should be able to reverse the list before feeding it to the ListView.

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

Answered By – chemamolins

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *