Skip to content

Commit a8b084f

Browse files
committed
inbox: Use compareTo rather than subtraction for comparison
The subtraction is fine if there isn't overflow, which should be impossible for Zulip message IDs. (They need to fit into 54 bits in order to not confuse the web client.) Still, compareTo feels a bit more explicit about what we mean.
1 parent faf00d9 commit a8b084f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/widgets/inbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class _InboxPageState extends State<InboxPage> with PerAccountStoreAwareStateMix
150150
topicItems.sort((a, b) {
151151
final (_, _, aLastUnreadId) = a;
152152
final (_, _, bLastUnreadId) = b;
153-
return bLastUnreadId - aLastUnreadId;
153+
return bLastUnreadId.compareTo(aLastUnreadId);
154154
});
155155
sections.add(_StreamSectionData(streamId, countInStream, topicItems));
156156
}

0 commit comments

Comments
 (0)