I have a model which defines some JSON from an Api.
abstract class ITrainingExerciseListingProvider with Store {
@observable
List exerciseList = [];
@observable
List<ExerciseModel> exerciseModelList = [];
If i try and put a exerciseList.sort(); itgives a constructor error.
I'm trying to get this listview to order on the length but i'm stuck!
ListView.separated(
// itemCount: 14,
itemCount: sl<ITrainingExerciseListingProvider>()
?.exerciseModelList
?.length,
Any suggestions are appreciated.
CodePudding user response:
You cannot sort your list on the base of your model class but you have to sort your list on the base of val of the model suppose name or any other field .
CodePudding user response:
Did you try this?
exerciseList.sort((o1, o2) {
// handle the sort logic here
return 1;
});
