I would like to sort my DataTable in relation of their Icons. I got the error message: Class 'Icon' has no instance method 'compareTo'. Receiver: Instance of 'Icon' Tried calling: compareTo(Instance of 'Icon') I copied the sorting Method for Strings which works fine and added it for the Icons. I want to order all Entries in my Data Table depending on the Icon. My map List<Map<String,dynamic>> from where I get the data from looks like this: List<Map<String, dynamic>> _books = [ { "test": Icon(Icons.ac_unit), "book": "Jimmy", "author": "Goethe", "id": "1", "testi": Switch( inactiveThumbColor: Colors.white, activeColor: Colors.white, activeTrackColor: Colors.green, inactiveTrackColor: Colors.grey, value: true, onChanged: (value) {}, ), }, ..... My Sorting function looks like this: List<DataColumn> _createColumns() { return [ DataColumn( label: Text('Test'), onSort: (columnIndex, _) { setState(() { _currentSortColumn = columnIndex; if (_isSortAsc) { _books.sort((a, b) => b['test'].compareTo(a['test'])); } else { _books.sort((a, b) => a['test'].compareTo(b['test'])); } _isSortAsc = !_isSortAsc; }); }, ), DataColumn( ..... Is there a way to do this? Continue reading...