Skip to content

Conversation

@atreeon
Copy link

@atreeon atreeon commented Mar 27, 2021

Hi, I did exactly the same thing a few days ago! Here is another one to choose from.

This version makes a few things type safe, for example the list must implement a new abstract class called Sortable

class Items implements Sortable {
  String name;
  int ram;
  Items(this.name, this.ram);

  Map<String, Comparable> sortableFields() {
    return {'name': name, 'price': price};
  }
}

It also does the asc, desc, sortable fields must implement Comparable, and I created a new button. I also added a couple of dart tests. I've updated the example too so you can see how it is supposed to work

…ltiple data types using the comparable interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant