nicer automatic loadOlder handling
This commit is contained in:
parent
b594f5a1d1
commit
b5bd752855
1 changed files with 3 additions and 2 deletions
|
|
@ -133,8 +133,9 @@ class RoomChatController extends AsyncNotifier<ChatController> {
|
||||||
|
|
||||||
ref.onDispose(controller.dispose);
|
ref.onDispose(controller.dispose);
|
||||||
|
|
||||||
for (final _ in List.filled(2, null)) {
|
// While there are under 20 messages, try up to two times to load more messages.
|
||||||
if (messages.length < 20) await loadOlder(controller);
|
for (var i = 0; i < 2 && messages.length < 20; i++) {
|
||||||
|
await loadOlder(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
return controller;
|
return controller;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue