check messagePagination nullability
This commit is contained in:
@@ -112,7 +112,7 @@ class MessageDao extends DatabaseAccessor<MoorChatDatabase>
|
|||||||
.map(_messageFromJoinRow)
|
.map(_messageFromJoinRow)
|
||||||
.get());
|
.get());
|
||||||
|
|
||||||
if (messagePagination.lessThan != null) {
|
if (messagePagination?.lessThan != null) {
|
||||||
final lessThanIndex = msgList.indexWhere(
|
final lessThanIndex = msgList.indexWhere(
|
||||||
(m) => m.id == messagePagination.lessThan,
|
(m) => m.id == messagePagination.lessThan,
|
||||||
);
|
);
|
||||||
@@ -120,7 +120,7 @@ class MessageDao extends DatabaseAccessor<MoorChatDatabase>
|
|||||||
msgList.removeRange(lessThanIndex, msgList.length);
|
msgList.removeRange(lessThanIndex, msgList.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (messagePagination.greaterThanOrEqual != null) {
|
if (messagePagination?.greaterThanOrEqual != null) {
|
||||||
final greaterThanIndex = msgList.indexWhere(
|
final greaterThanIndex = msgList.indexWhere(
|
||||||
(m) => m.id == messagePagination.greaterThanOrEqual,
|
(m) => m.id == messagePagination.greaterThanOrEqual,
|
||||||
);
|
);
|
||||||
@@ -128,7 +128,7 @@ class MessageDao extends DatabaseAccessor<MoorChatDatabase>
|
|||||||
msgList.removeRange(0, greaterThanIndex);
|
msgList.removeRange(0, greaterThanIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (messagePagination.limit != null) {
|
if (messagePagination?.limit != null) {
|
||||||
return msgList.take(messagePagination.limit).toList();
|
return msgList.take(messagePagination.limit).toList();
|
||||||
}
|
}
|
||||||
return msgList;
|
return msgList;
|
||||||
|
|||||||
Reference in New Issue
Block a user