From 6846b7d5c669867ef3814b4d16601f7804176195 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 25 Jun 2020 09:04:26 +0200 Subject: [PATCH] Use timestamp as sort order --- lib/src/room.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index 77b5295..6c74aab 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -81,7 +81,11 @@ class Room { double _oldestSortOrder; double get newSortOrder { - _newestSortOrder++; + var now = DateTime.now().millisecondsSinceEpoch.toDouble(); + if (_newestSortOrder >= now) { + now = _newestSortOrder + 1; + } + _newestSortOrder = now; return _newestSortOrder; }