opt: handle response

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-01 08:59:12 +08:00
parent 312ce6e639
commit 11398ca64b
25 changed files with 339 additions and 306 deletions

View File

@@ -29,7 +29,9 @@ abstract class CommonController extends GetxController {
LoadingState response = await customGetData();
if (response is Success) {
if (!customHandleResponse(response)) {
isEnd = response.response.isEmpty;
if ((response.response as List?).isNullOrEmpty) {
isEnd = true;
}
List currentList = loadingState.value is Success
? (loadingState.value as Success).response
: [];

View File

@@ -116,7 +116,7 @@ abstract class ReplyController extends CommonController {
} else if (loadingState.value is Success) {
replies.insertAll(0, (loadingState.value as Success).response.replies);
}
if (replies.length >= count.value) {
if (isEnd.not && replies.length >= count.value) {
isEnd = true;
}
loadingState.value = LoadingState.success(response.response);