Crash on getDirectChatFromUserId in client.dart
There is a an issue in the getDirectChatFromUserId when you try to compare 2 dates :
if (potentialRooms.isNotEmpty) {
return potentialRooms
.fold(
null,
(prev, r) => prev == null
? r
: (prev.lastEvent.originServerTs <
r.lastEvent.originServerTs
? r
: prev))
.id;
}
This is the right way to do it :
if (potentialRooms.isNotEmpty) {
return potentialRooms
.fold<Room>(
null,
(prev, r) => prev == null
? r
: (prev.lastEvent.originServerTs.isBefore(
r.lastEvent.originServerTs)
? r
: prev))
.id;
}