refa: query data (#659)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-04-10 21:43:01 +08:00
committed by GitHub
parent 99b19e7b03
commit e1b73f4766
128 changed files with 1493 additions and 1987 deletions

View File

@@ -10,13 +10,13 @@ import 'api.dart';
import 'init.dart';
class LiveHttp {
static Future<LoadingState> liveList(
static Future<LoadingState<List<LiveItemModel>?>> liveList(
{int? vmid, int? pn, int? ps, String? orderType}) async {
var res = await Request().get(Api.liveList,
queryParameters: {'page': pn, 'page_size': 30, 'platform': 'web'});
if (res.data['code'] == 0) {
List<LiveItemModel> list = res.data['data']['list']
.map<LiveItemModel>((e) => LiveItemModel.fromJson(e))
List<LiveItemModel>? list = (res.data['data']?['list'] as List?)
?.map<LiveItemModel>((e) => LiveItemModel.fromJson(e))
.toList();
return LoadingState.success(list);
} else {