Skip to content

Commit a30de87

Browse files
committed
Key was wrong on order change
1 parent dd837d1 commit a30de87

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/src/utils/parse_live_list.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,15 @@ class ParseLiveList<T extends ParseObject> {
317317
return 'NotFound';
318318
}
319319

320+
String getIdentifier(int index) {
321+
if (index < _list.length) {
322+
return _list[index].object.get<String>(keyVarObjectId) +
323+
_list[index].object.get<DateTime>(keyVarUpdatedAt)?.toString() ??
324+
'';
325+
}
326+
return 'NotFound';
327+
}
328+
320329
T getLoadedAt(int index) {
321330
if (index < _list.length && _list[index].loaded) {
322331
return _list[index].object;
@@ -521,7 +530,8 @@ class _ParseLiveListWidgetState<T extends ParseObject>
521530
itemBuilder:
522531
(BuildContext context, int index, Animation<double> animation) {
523532
return ParseLiveListElementWidget<T>(
524-
key: ValueKey<String>(_liveList?.idOf(index) ?? '_NotFound'),
533+
key: ValueKey<String>(
534+
_liveList?.getIdentifier(index) ?? '_NotFound'),
525535
stream: () => _liveList?.getAt(index),
526536
loadedData: () => _liveList?.getLoadedAt(index),
527537
sizeFactor: animation,

0 commit comments

Comments
 (0)