sortRoomsBy property
RoomSorter
get
sortRoomsBy
The compare function how the rooms should be sorted internally. By default rooms are sorted by timestamp of the last m.room.message event or the last event if there is no known message.
Implementation
RoomSorter get sortRoomsBy => (a, b) {
if (pinInvitedRooms &&
a.membership != b.membership &&
[a.membership, b.membership].any((m) => m == Membership.invite)) {
return a.membership == Membership.invite ? -1 : 1;
} else if (a.isFavourite != b.isFavourite) {
return a.isFavourite ? -1 : 1;
} else if (pinUnreadRooms &&
a.notificationCount != b.notificationCount) {
return b.notificationCount.compareTo(a.notificationCount);
} else {
return b.timeCreated.millisecondsSinceEpoch
.compareTo(a.timeCreated.millisecondsSinceEpoch);
}
};