From 3c34e43827c5b3a05bc8f45de6b661cd9330d983 Mon Sep 17 00:00:00 2001 From: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Date: Sat, 23 Aug 2025 18:25:41 +0800 Subject: [PATCH] opt: non null (#1091) * opt: type * opt: type 2 * opt: type 3 --- lib/common/widgets/dialog/dialog.dart | 2 +- lib/common/widgets/image/image_save.dart | 2 +- lib/common/widgets/image/nine_grid_view.dart | 2 +- .../loading_widget/loading_widget.dart | 8 +- lib/http/dynamics.dart | 56 +++++++------- lib/http/fan.dart | 6 +- lib/http/fav.dart | 54 +++++++------- lib/http/follow.dart | 4 +- lib/http/init.dart | 4 +- lib/http/live.dart | 53 ++++++++------ lib/http/match.dart | 2 +- lib/http/member.dart | 70 +++++++++--------- lib/http/msg.dart | 50 +++++++------ lib/http/pgc.dart | 34 ++++----- lib/http/reply.dart | 8 +- lib/http/search.dart | 31 ++++---- lib/http/user.dart | 17 +++-- lib/http/validate.dart | 8 +- lib/http/video.dart | 73 +++++++++++-------- lib/pages/article_list/controller.dart | 2 +- .../common/common_whisper_controller.dart | 2 +- .../publish/common_rich_text_pub_page.dart | 2 +- .../dynamics/widgets/additional_panel.dart | 6 +- lib/pages/dynamics/widgets/author_panel.dart | 4 +- lib/pages/dynamics/widgets/dynamic_panel.dart | 2 +- .../dynamics/widgets/rich_node_panel.dart | 2 +- .../dynamics_create_reserve/controller.dart | 2 +- .../dynamics_create_vote/controller.dart | 2 +- lib/pages/dynamics_tab/controller.dart | 2 +- lib/pages/episode_panel/view.dart | 2 +- lib/pages/fav/article/controller.dart | 2 +- lib/pages/fav/article/view.dart | 2 +- lib/pages/fav/cheese/controller.dart | 2 +- lib/pages/fav/cheese/view.dart | 2 +- lib/pages/fav/topic/controller.dart | 2 +- lib/pages/fav/topic/view.dart | 2 +- lib/pages/follow/child/child_controller.dart | 2 +- lib/pages/follow/controller.dart | 4 +- lib/pages/follow/view.dart | 2 +- lib/pages/live/controller.dart | 4 +- lib/pages/live_dm_block/controller.dart | 12 +-- lib/pages/member_dynamics/controller.dart | 2 +- lib/pages/member_search/child/controller.dart | 4 +- lib/pages/msg_feed_top/at_me/controller.dart | 2 +- lib/pages/msg_feed_top/at_me/view.dart | 3 +- .../msg_feed_top/like_detail/controller.dart | 2 +- .../msg_feed_top/like_me/controller.dart | 7 +- lib/pages/msg_feed_top/like_me/view.dart | 4 +- .../msg_feed_top/reply_me/controller.dart | 2 +- lib/pages/msg_feed_top/reply_me/view.dart | 2 +- .../msg_feed_top/sys_msg/controller.dart | 2 +- lib/pages/msg_feed_top/sys_msg/view.dart | 2 +- lib/pages/pgc_review/child/controller.dart | 2 +- lib/pages/pgc_review/child/view.dart | 2 +- lib/pages/rank/zone/controller.dart | 2 +- lib/pages/rcmd/controller.dart | 14 +++- lib/pages/rcmd/view.dart | 3 +- lib/pages/save_panel/view.dart | 7 +- lib/pages/setting/pages/color_select.dart | 4 +- lib/pages/setting/widgets/select_dialog.dart | 2 +- lib/pages/video/controller.dart | 4 +- .../video/introduction/pgc/controller.dart | 8 +- lib/pages/video/member/view.dart | 2 +- lib/pages/video/view.dart | 4 +- lib/pages/whisper/widgets/item.dart | 2 +- .../whisper_detail/widget/chat_item.dart | 19 +++-- lib/plugin/pl_player/controller.dart | 20 ++--- lib/services/audio_handler.dart | 3 +- .../accounts/account_manager/account_mgr.dart | 8 +- lib/utils/page_utils.dart | 18 +++-- lib/utils/reply_utils.dart | 9 +-- lib/utils/request_utils.dart | 39 +++++----- lib/utils/update.dart | 2 +- lib/utils/utils.dart | 2 +- lib/utils/wbi_sign.dart | 6 +- 75 files changed, 400 insertions(+), 362 deletions(-) diff --git a/lib/common/widgets/dialog/dialog.dart b/lib/common/widgets/dialog/dialog.dart index 99823fd61..cefece90d 100644 --- a/lib/common/widgets/dialog/dialog.dart +++ b/lib/common/widgets/dialog/dialog.dart @@ -4,7 +4,7 @@ import 'package:get/get.dart'; void showConfirmDialog({ required BuildContext context, required String title, - dynamic content, + Object? content, required VoidCallback onConfirm, }) { showDialog( diff --git a/lib/common/widgets/image/image_save.dart b/lib/common/widgets/image/image_save.dart index d9d77fdd7..6e3374bfc 100644 --- a/lib/common/widgets/image/image_save.dart +++ b/lib/common/widgets/image/image_save.dart @@ -10,7 +10,7 @@ import 'package:get/get.dart'; void imageSaveDialog({ required String? title, required String? cover, - dynamic aid, + Object? aid, String? bvid, }) { final double imgWidth = Get.mediaQuery.size.shortestSide - 8 * 2; diff --git a/lib/common/widgets/image/nine_grid_view.dart b/lib/common/widgets/image/nine_grid_view.dart index 0174bcf5a..ffcd8c0fb 100644 --- a/lib/common/widgets/image/nine_grid_view.dart +++ b/lib/common/widgets/image/nine_grid_view.dart @@ -506,7 +506,7 @@ class _ImageUtil { ); } }, - onError: (dynamic exception, StackTrace? stackTrace) { + onError: (exception, stackTrace) { imageStream.removeListener(listener); if (!completer.isCompleted) { completer.completeError(exception, stackTrace); diff --git a/lib/common/widgets/loading_widget/loading_widget.dart b/lib/common/widgets/loading_widget/loading_widget.dart index 3dc3ee6cc..ce9ec642e 100644 --- a/lib/common/widgets/loading_widget/loading_widget.dart +++ b/lib/common/widgets/loading_widget/loading_widget.dart @@ -6,13 +6,17 @@ Widget get loadingWidget => const Center(child: CircularProgressIndicator()); Widget get linearLoading => const SliverToBoxAdapter(child: LinearProgressIndicator()); -Widget errorWidget({errMsg, onReload}) => HttpError( +Widget errorWidget({String? errMsg, VoidCallback? onReload}) => HttpError( isSliver: false, errMsg: errMsg, onReload: onReload, ); -Widget scrollErrorWidget({errMsg, onReload, controller}) => CustomScrollView( +Widget scrollErrorWidget({ + String? errMsg, + VoidCallback? onReload, + ScrollController? controller, +}) => CustomScrollView( controller: controller, slivers: [ HttpError( diff --git a/lib/http/dynamics.dart b/lib/http/dynamics.dart index 4e184713a..a7732a3fb 100644 --- a/lib/http/dynamics.dart +++ b/lib/http/dynamics.dart @@ -31,14 +31,14 @@ class DynamicsHttp { int? mid, Set? tempBannedList, }) async { - Map data = { + final data = { if (type == DynamicsTabType.up) - 'host_mid': mid + 'host_mid': mid! else ...{ 'type': type.name, 'timezone_offset': '-480', }, - 'offset': offset, + 'offset': ?offset, 'features': 'itemOpusStyle,listOnlyfans', }; var res = await Request().get(Api.followDynamic, queryParameters: data); @@ -120,11 +120,11 @@ class DynamicsHttp { } static Future createDynamic({ - dynamic mid, - dynamic dynIdStr, // repost dyn - dynamic rid, // repost video - dynamic dynType, - dynamic rawText, + Object? mid, + Object? dynIdStr, // repost dyn + Object? rid, // repost video + Object? dynType, + Object? rawText, List? pics, int? publishTime, ReplyOptionType? replyOption, @@ -213,9 +213,9 @@ class DynamicsHttp { // static Future dynamicDetail({ - dynamic id, - dynamic rid, - dynamic type, + Object? id, + Object? rid, + Object? type, bool clearCookie = false, }) async { var res = await Request().get( @@ -255,7 +255,7 @@ class DynamicsHttp { } static Future setTop({ - required dynamic dynamicId, + required Object dynamicId, }) async { var res = await Request().post( Api.setTopDyn, @@ -274,7 +274,7 @@ class DynamicsHttp { } static Future rmTop({ - required dynamic dynamicId, + required Object dynamicId, }) async { var res = await Request().post( Api.rmTopDyn, @@ -293,7 +293,7 @@ class DynamicsHttp { } static Future articleInfo({ - required dynamic cvId, + required Object cvId, }) async { var res = await Request().get( Api.articleInfo, @@ -315,7 +315,7 @@ class DynamicsHttp { } static Future> articleView({ - required dynamic cvId, + required Object cvId, }) async { final res = await Request().get( Api.articleView, @@ -333,7 +333,7 @@ class DynamicsHttp { } static Future> opusDetail({ - required dynamic opusId, + required Object opusId, }) async { final res = await Request().get( Api.opusDetail, @@ -350,7 +350,7 @@ class DynamicsHttp { } } - static Future> voteInfo(dynamic voteId) async { + static Future> voteInfo(Object voteId) async { final res = await Request().get( Api.voteInfo, queryParameters: {'vote_id': voteId}, @@ -392,7 +392,9 @@ class DynamicsHttp { } } - static Future> topicTop({required topicId}) async { + static Future> topicTop({ + required Object topicId, + }) async { final res = await Request().get( Api.topicTop, queryParameters: { @@ -411,7 +413,7 @@ class DynamicsHttp { } static Future> topicFeed({ - required topicId, + required Object topicId, required String offset, required int sortBy, }) async { @@ -438,7 +440,7 @@ class DynamicsHttp { } static Future> articleList({ - required id, + required Object id, }) async { final res = await Request().get( Api.articleList, @@ -455,10 +457,10 @@ class DynamicsHttp { } static Future dynReserve({ - required reserveId, - required curBtnStatus, - required dynamicIdStr, - required reserveTotal, + required Object reserveId, + required Object curBtnStatus, + required Object dynamicIdStr, + required Object reserveTotal, }) async { var res = await Request().post( Api.dynReserve, @@ -504,7 +506,7 @@ class DynamicsHttp { } } - static Future?>> dynPic(dynamic id) async { + static Future?>> dynPic(Object id) async { final res = await Request().get( Api.dynPic, queryParameters: { @@ -529,7 +531,7 @@ class DynamicsHttp { final res = await Request().get( Api.dynMention, queryParameters: { - if (keyword?.isNotEmpty == true) 'keyword': keyword, + if (keyword?.isNotEmpty == true) 'keyword': keyword!, 'web_location': 333.1365, }, ); @@ -619,7 +621,7 @@ class DynamicsHttp { } static Future> reserveInfo({ - required dynamic sid, + required Object sid, }) async { final res = await Request().get( Api.reserveInfo, diff --git a/lib/http/fan.dart b/lib/http/fan.dart index 3df1a5d80..d1787fa55 100644 --- a/lib/http/fan.dart +++ b/lib/http/fan.dart @@ -5,8 +5,8 @@ import 'package:PiliPlus/models_new/fans/data.dart'; class FanHttp { static Future> fans({ - int? vmid, - int? pn, + required int vmid, + required int pn, int ps = 20, String? orderType, }) async { @@ -17,7 +17,7 @@ class FanHttp { 'pn': pn, 'ps': ps, 'order': 'desc', - 'order_type': orderType, + 'order_type': ?orderType, }, ); if (res.data['code'] == 0) { diff --git a/lib/http/fav.dart b/lib/http/fav.dart index dd682b102..5e5447baf 100644 --- a/lib/http/fav.dart +++ b/lib/http/fav.dart @@ -18,7 +18,7 @@ import 'package:PiliPlus/utils/app_sign.dart'; import 'package:dio/dio.dart'; class FavHttp { - static Future favFavFolder(mediaId) async { + static Future favFavFolder(Object mediaId) async { var res = await Request().post( Api.favFavFolder, data: { @@ -34,7 +34,7 @@ class FavHttp { } } - static Future unfavFavFolder(mediaId) async { + static Future unfavFavFolder(Object mediaId) async { var res = await Request().post( Api.unfavFavFolder, data: { @@ -165,7 +165,7 @@ class FavHttp { } } - static Future addFavPugv(seasonId) async { + static Future addFavPugv(Object seasonId) async { var res = await Request().post( Api.addFavPugv, data: { @@ -181,7 +181,7 @@ class FavHttp { } } - static Future delFavPugv(seasonId) async { + static Future delFavPugv(Object seasonId) async { var res = await Request().post( Api.delFavPugv, data: { @@ -215,7 +215,7 @@ class FavHttp { } } - static Future addFavTopic(topicId) async { + static Future addFavTopic(Object topicId) async { var res = await Request().post( Api.addFavTopic, data: { @@ -231,7 +231,7 @@ class FavHttp { } } - static Future delFavTopic(topicId) async { + static Future delFavTopic(Object topicId) async { var res = await Request().post( Api.delFavTopic, data: { @@ -247,7 +247,7 @@ class FavHttp { } } - static Future likeTopic(topicId, bool isLike) async { + static Future likeTopic(Object topicId, bool isLike) async { var res = await Request().post( Api.likeTopic, data: { @@ -284,7 +284,7 @@ class FavHttp { } static Future addFavArticle({ - required dynamic id, + required Object id, }) async { var res = await Request().post( Api.addFavArticle, @@ -304,7 +304,7 @@ class FavHttp { } static Future delFavArticle({ - required dynamic id, + required Object id, }) async { var res = await Request().post( Api.delFavArticle, @@ -387,7 +387,7 @@ class FavHttp { } static Future> favPgc({ - required dynamic mid, + required Object mid, required int type, required int pn, int? followStatus, @@ -412,7 +412,7 @@ class FavHttp { static Future> userfavFolder({ required int pn, required int ps, - required dynamic mid, + required Object mid, }) async { var res = await Request().get( Api.userFavFolder, @@ -452,7 +452,7 @@ class FavHttp { } static Future sortFav({ - required dynamic mediaId, + required Object mediaId, required String sort, }) async { Map data = { @@ -476,7 +476,7 @@ class FavHttp { } static Future cleanFav({ - required dynamic mediaId, + required Object mediaId, }) async { var res = await Request().post( Api.cleanFav, @@ -519,7 +519,7 @@ class FavHttp { static Future addOrEditFolder({ required bool isAdd, - dynamic mediaId, + Object? mediaId, required String title, required int privacy, required String cover, @@ -547,7 +547,7 @@ class FavHttp { } static Future favFolderInfo({ - dynamic mediaId, + required Object mediaId, }) async { var res = await Request().get( Api.favFolderInfo, @@ -564,7 +564,7 @@ class FavHttp { static Future seasonFav({ required bool isFav, - required dynamic seasonId, + required Object seasonId, }) async { var res = await Request().post( isFav ? Api.unfavSeason : Api.favSeason, @@ -625,8 +625,8 @@ class FavHttp { } static Future communityAction({ - required dynamic opusId, - required dynamic action, + required Object opusId, + required Object action, }) async { var res = await Request().post( Api.communityAction, @@ -673,8 +673,8 @@ class FavHttp { // (取消)收藏 static Future unfavAll({ - required rid, - required type, + required Object rid, + required Object type, }) async { var res = await Request().post( Api.unfavAll, @@ -695,9 +695,9 @@ class FavHttp { static Future copyOrMoveFav({ required bool isCopy, required bool isFav, - required dynamic srcMediaId, - required dynamic tarMediaId, - dynamic mid, + required Object? srcMediaId, + required Object tarMediaId, + mid, required String resources, }) async { var res = await Request().post( @@ -709,7 +709,7 @@ class FavHttp { ? Api.copyToview : Api.moveToview, data: { - 'src_media_id': ?srcMediaId, + 'src_media_id': srcMediaId, 'tar_media_id': tarMediaId, 'mid': ?mid, 'resources': resources, @@ -739,9 +739,9 @@ class FavHttp { // 查看视频被收藏在哪个文件夹 static Future> videoInFolder({ - dynamic mid, - dynamic rid, - dynamic type, + required Object mid, + required Object rid, + Object? type, }) async { var res = await Request().get( Api.favFolder, diff --git a/lib/http/follow.dart b/lib/http/follow.dart index 46b3e426a..78337acfc 100644 --- a/lib/http/follow.dart +++ b/lib/http/follow.dart @@ -5,8 +5,8 @@ import 'package:PiliPlus/models_new/follow/data.dart'; class FollowHttp { static Future> followings({ - int? vmid, - int? pn, + required int vmid, + required int pn, int ps = 20, String orderType = '', // ''=>最近关注,'attention'=>最常访问 }) async { diff --git a/lib/http/init.dart b/lib/http/init.dart index 3606f85af..cb5eeb97c 100644 --- a/lib/http/init.dart +++ b/lib/http/init.dart @@ -181,7 +181,7 @@ class Request { */ Future get( String url, { - Map? queryParameters, + Map? queryParameters, Options? options, CancelToken? cancelToken, }) async { @@ -209,7 +209,7 @@ class Request { Future post( String url, { Object? data, - Map? queryParameters, + Map? queryParameters, Options? options, CancelToken? cancelToken, }) async { diff --git a/lib/http/live.dart b/lib/http/live.dart index 5164f56bb..5b89ad5e3 100644 --- a/lib/http/live.dart +++ b/lib/http/live.dart @@ -24,7 +24,12 @@ import 'package:PiliPlus/utils/wbi_sign.dart'; import 'package:dio/dio.dart'; class LiveHttp { - static Future sendLiveMsg({roomId, msg, dmType, emoticonOptions}) async { + static Future sendLiveMsg({ + required Object roomId, + required Object msg, + Object? dmType, + Object? emoticonOptions, + }) async { String csrf = Accounts.main.csrf; var res = await Request().post( Api.sendLiveMsg, @@ -66,7 +71,11 @@ class LiveHttp { } } - static Future liveRoomInfo({roomId, qn, bool onlyAudio = false}) async { + static Future liveRoomInfo({ + required Object roomId, + Object? qn, + bool onlyAudio = false, + }) async { var res = await Request().get( Api.liveRoomInfo, queryParameters: { @@ -74,7 +83,7 @@ class LiveHttp { 'protocol': '0, 1', 'format': '0, 1, 2', 'codec': '0, 1', - 'qn': qn, + 'qn': ?qn, 'platform': 'web', 'ptype': 8, 'dolby': 5, @@ -92,7 +101,7 @@ class LiveHttp { } } - static Future liveRoomInfoH5({roomId, qn}) async { + static Future liveRoomInfoH5({required Object roomId}) async { var res = await Request().get( Api.liveRoomInfoH5, queryParameters: { @@ -109,7 +118,7 @@ class LiveHttp { } } - static Future liveRoomDanmaPrefetch({roomId}) async { + static Future liveRoomDanmaPrefetch({required Object roomId}) async { var res = await Request().get( Api.liveRoomDmPrefetch, queryParameters: {'roomid': roomId}, @@ -127,7 +136,7 @@ class LiveHttp { } } - static Future liveRoomGetDanmakuToken({roomId}) async { + static Future liveRoomGetDanmakuToken({required Object roomId}) async { var res = await Request().get( Api.liveRoomDmToken, queryParameters: await WbiSign.makSign({ @@ -168,7 +177,7 @@ class LiveHttp { bool? moduleSelect, }) async { final params = { - if (isLogin) 'access_key': Accounts.main.accessKey, + if (isLogin) 'access_key': Accounts.main.accessKey!, 'appkey': Constants.appKey, 'channel': 'master', 'actionKey': 'appkey', @@ -245,12 +254,12 @@ class LiveHttp { static Future> liveSecondList({ required int pn, required bool isLogin, - required areaId, - required parentAreaId, + required Object? areaId, + required Object? parentAreaId, String? sortType, }) async { final params = { - if (isLogin) 'access_key': Accounts.main.accessKey, + if (isLogin) 'access_key': Accounts.main.accessKey!, 'appkey': Constants.appKey, 'actionKey': 'appkey', 'channel': 'master', @@ -316,7 +325,7 @@ class LiveHttp { required bool isLogin, }) async { final params = { - if (isLogin) 'access_key': Accounts.main.accessKey, + if (isLogin) 'access_key': Accounts.main.accessKey!, 'appkey': Constants.appKey, 'actionKey': 'appkey', 'build': 8430300, @@ -355,7 +364,7 @@ class LiveHttp { required bool isLogin, }) async { final params = { - if (isLogin) 'access_key': Accounts.main.accessKey, + if (isLogin) 'access_key': Accounts.main.accessKey!, 'appkey': Constants.appKey, 'actionKey': 'appkey', 'build': 8430300, @@ -432,10 +441,10 @@ class LiveHttp { static Future?>> liveRoomAreaList({ required bool isLogin, - required parentid, + required Object parentid, }) async { final params = { - if (isLogin) 'access_key': Accounts.main.accessKey, + if (isLogin) 'access_key': Accounts.main.accessKey!, 'appkey': Constants.appKey, 'actionKey': 'appkey', 'build': 8430300, @@ -478,7 +487,7 @@ class LiveHttp { required LiveSearchType type, }) async { final params = { - if (isLogin) 'access_key': Accounts.main.accessKey, + if (isLogin) 'access_key': Accounts.main.accessKey!, 'appkey': Constants.appKey, 'actionKey': 'appkey', 'build': 8430300, @@ -514,7 +523,7 @@ class LiveHttp { } static Future> getLiveInfoByUser( - dynamic roomId, + Object roomId, ) async { var res = await Request().get( Api.getLiveInfoByUser, @@ -595,8 +604,8 @@ class LiveHttp { } static Future liveShieldUser({ - required dynamic uid, - required dynamic roomid, + required Object uid, + required Object roomid, required int type, }) async { final csrf = Accounts.main.csrf; @@ -620,9 +629,9 @@ class LiveHttp { static Future liveLikeReport({ required int clickTime, - required dynamic roomId, - required dynamic uid, - required dynamic anchorId, + required Object roomId, + required Object uid, + Object? anchorId, }) async { var res = await Request().post( Api.liveLikeReport, @@ -630,7 +639,7 @@ class LiveHttp { 'click_time': clickTime, 'room_id': roomId, 'uid': uid, - 'anchor_id': anchorId, + 'anchor_id': ?anchorId, 'web_location': 444.8, 'csrf': Accounts.heartbeat.csrf, }), diff --git a/lib/http/match.dart b/lib/http/match.dart index 0a5ebc670..6d7dad2dc 100644 --- a/lib/http/match.dart +++ b/lib/http/match.dart @@ -5,7 +5,7 @@ import 'package:PiliPlus/models_new/match/match_info/contest.dart'; import 'package:PiliPlus/models_new/match/match_info/data.dart'; class MatchHttp { - static Future> matchInfo(dynamic cid) async { + static Future> matchInfo(Object cid) async { var res = await Request().get( Api.matchInfo, queryParameters: { diff --git a/lib/http/member.dart b/lib/http/member.dart index f23efca1c..3f95fc830 100644 --- a/lib/http/member.dart +++ b/lib/http/member.dart @@ -31,7 +31,7 @@ import 'package:dio/dio.dart'; class MemberHttp { static Future reportMember( - dynamic mid, { + Object mid, { String? reason, int? reasonV2, }) async { @@ -86,7 +86,7 @@ class MemberHttp { } static Future> seasonSeriesList({ - required int? mid, + required int mid, required int pn, }) async { var res = await Request().get( @@ -108,7 +108,7 @@ class MemberHttp { static Future> spaceArchive({ required ContributeType type, - required int? mid, + required int mid, String? aid, String? order, String? sort, @@ -116,7 +116,7 @@ class MemberHttp { int? next, int? seasonId, int? seriesId, - includeCursor, + Object? includeCursor, }) async { final params = { 'aid': ?aid, @@ -205,13 +205,13 @@ class MemberHttp { } static Future spaceStory({ - required mid, - required aid, - required beforeSize, - required afterSize, - required cid, - required contain, - required index, + required Object mid, + required Object aid, + required Object beforeSize, + required Object afterSize, + required Object cid, + required Object contain, + required Object index, }) async { final params = { 'aid': aid, @@ -248,8 +248,8 @@ class MemberHttp { } static Future> space({ - int? mid, - dynamic fromViewAid, + required int mid, + Object? fromViewAid, }) async { final params = { 'build': 8430300, @@ -281,7 +281,7 @@ class MemberHttp { } static Future memberInfo({ - int? mid, + required int mid, String token = '', }) async { String dmImgStr = Utils.base64EncodeRandomString(16, 64); @@ -317,7 +317,7 @@ class MemberHttp { } } - static Future memberStat({int? mid}) async { + static Future memberStat({required int mid}) async { var res = await Request().get(Api.userStat, queryParameters: {'vmid': mid}); if (res.data['code'] == 0) { return {'status': true, 'data': res.data['data']}; @@ -326,7 +326,7 @@ class MemberHttp { } } - static Future memberCardInfo({int? mid}) async { + static Future memberCardInfo({required int mid}) async { var res = await Request().get( Api.memberCardInfo, queryParameters: { @@ -345,7 +345,7 @@ class MemberHttp { } static Future> searchArchive({ - required mid, + required Object mid, int ps = 30, int tid = 0, int? pn, @@ -359,7 +359,7 @@ class MemberHttp { 'mid': mid, 'ps': ps, 'tid': tid, - 'pn': pn, + 'pn': ?pn, 'keyword': ?keyword, 'order': order, 'platform': 'web', @@ -394,7 +394,7 @@ class MemberHttp { // 用户动态 static Future> memberDynamic({ String? offset, - int? mid, + required int mid, }) async { String dmImgStr = Utils.base64EncodeRandomString(16, 64); String dmCoverImgStr = Utils.base64EncodeRandomString(32, 128); @@ -431,8 +431,8 @@ class MemberHttp { // 搜索用户动态 static Future memberDynamicSearch({ required int pn, - required dynamic mid, - required dynamic offset, + required Object mid, + required Object offset, required String keyword, }) async { var res = await Request().get( @@ -461,8 +461,8 @@ class MemberHttp { static Future> dynSearch({ required int pn, - required dynamic mid, - required dynamic offset, + required Object mid, + required Object offset, required String keyword, }) async { var res = await Request().get( @@ -545,14 +545,14 @@ class MemberHttp { // 获取某分组下的up static Future> followUpGroup({ int? mid, - int? tagid, - int? pn, + required int tagid, + required int pn, int ps = 20, }) async { var res = await Request().get( Api.followUpGroup, queryParameters: { - 'mid': mid, + 'mid': ?mid, 'tagid': tagid, 'pn': pn, 'ps': ps, @@ -573,7 +573,7 @@ class MemberHttp { } } - static Future createFollowTag(tagName) async { + static Future createFollowTag(Object tagName) async { var res = await Request().post( Api.createFollowTag, queryParameters: { @@ -593,7 +593,7 @@ class MemberHttp { } } - static Future updateFollowTag(tagid, name) async { + static Future updateFollowTag(Object tagid, Object name) async { var res = await Request().post( Api.updateFollowTag, queryParameters: { @@ -614,7 +614,7 @@ class MemberHttp { } } - static Future delFollowTag(tagid) async { + static Future delFollowTag(Object tagid) async { var res = await Request().post( Api.delFollowTag, queryParameters: { @@ -669,7 +669,7 @@ class MemberHttp { required int pn, required String name, }) async { - Map data = { + final data = { 'vmid': mid, 'pn': pn, 'ps': ps, @@ -679,14 +679,10 @@ class MemberHttp { 'name': name, 'web_location': 333.999, }; - Map params = await WbiSign.makSign(data); + await WbiSign.makSign(data); var res = await Request().get( Api.followSearch, - queryParameters: { - ...data, - 'w_rid': params['w_rid'], - 'wts': params['wts'], - }, + queryParameters: data, ); if (res.data['code'] == 0) { return Success(FollowData.fromJson(res.data['data'])); @@ -719,7 +715,7 @@ class MemberHttp { } static Future> upowerRank({ - required upMid, + required Object upMid, required int page, int? privilegeType, }) async { diff --git a/lib/http/msg.dart b/lib/http/msg.dart index 1ea4dbaab..4aa4569cd 100644 --- a/lib/http/msg.dart +++ b/lib/http/msg.dart @@ -86,7 +86,7 @@ class MsgHttp { } static Future> msgLikeDetail({ - required dynamic cardId, + required Object cardId, required int pn, }) async { var res = await Request().get( @@ -155,7 +155,7 @@ class MsgHttp { } static Future uploadImage({ - required dynamic path, + required String path, required String bucket, required String dir, }) async { @@ -211,7 +211,7 @@ class MsgHttp { } static Future createTextDynamic( - dynamic content, + Object content, ) async { String csrf = Accounts.main.csrf; Map data = await WbiSign.makSign({ @@ -237,7 +237,11 @@ class MsgHttp { } } - static Future removeDynamic({required dynIdStr, dynType, ridStr}) async { + static Future removeDynamic({ + required Object dynIdStr, + Object? dynType, + Object? ridStr, + }) async { var res = await Request().post( Api.removeDynamic, queryParameters: { @@ -258,7 +262,7 @@ class MsgHttp { } static Future removeMsg( - dynamic talkerId, + Object talkerId, ) async { String csrf = Accounts.main.csrf; Map data = await WbiSign.makSign({ @@ -283,7 +287,7 @@ class MsgHttp { static Future delMsgfeed( int tp, - dynamic id, + Object id, ) async { String csrf = Accounts.main.csrf; var res = await Request().post( @@ -309,7 +313,7 @@ class MsgHttp { } static Future delSysMsg( - dynamic id, + Object id, ) async { String csrf = Accounts.main.csrf; var res = await Request().post( @@ -337,7 +341,7 @@ class MsgHttp { } static Future setTop({ - required dynamic talkerId, + required Object talkerId, required int opType, }) async { String csrf = Accounts.main.csrf; @@ -367,8 +371,8 @@ class MsgHttp { // 消息标记已读 static Future ackSessionMsg({ - int? talkerId, - int? ackSeqno, + required int talkerId, + required int ackSeqno, }) async { String csrf = Accounts.main.csrf; final params = await WbiSign.makSign({ @@ -399,14 +403,14 @@ class MsgHttp { // 发送私信 static Future sendMsg({ - int? senderUid, - int? receiverId, + required int senderUid, + required int receiverId, int? msgType, - dynamic content, + required Object content, }) async { String csrf = Accounts.main.csrf; final devId = getDevId(); - Map data = { + final data = { 'msg': { 'sender_uid': senderUid, 'receiver_id': receiverId, @@ -424,15 +428,15 @@ class MsgHttp { 'csrf_token': csrf, 'csrf': csrf, }; - Map params = await WbiSign.makSign(data); + final params = await WbiSign.makSign(data); var res = await Request().post( Api.sendMsg, - queryParameters: { + queryParameters: { 'w_sender_uid': senderUid, 'w_receiver_id': receiverId, 'w_dev_id': devId, - 'w_rid': params['w_rid'], - 'wts': params['wts'], + 'w_rid': params['w_rid']!, + 'wts': params['wts']!, }, data: data, options: Options( @@ -454,7 +458,7 @@ class MsgHttp { } static Future msgSetNotice({ - required dynamic id, + required Object id, required int noticeState, }) async { final csrf = Accounts.main.csrf; @@ -482,9 +486,9 @@ class MsgHttp { } static Future setMsgDnd({ - required uid, + required Object uid, required int setting, - required dndUid, + required Object dndUid, }) async { final csrf = Accounts.main.csrf; var res = await Request().post( @@ -557,7 +561,7 @@ class MsgHttp { } static Future> getSessionSs({ - required talkerUid, + required Object talkerUid, }) async { final csrf = Accounts.main.csrf; var res = await Request().get( @@ -578,7 +582,7 @@ class MsgHttp { } static Future?>> getMsgDnd({ - required uidsStr, + required Object uidsStr, }) async { final csrf = Accounts.main.csrf; var res = await Request().get( diff --git a/lib/http/pgc.dart b/lib/http/pgc.dart index 83f40baee..7032d6de0 100644 --- a/lib/http/pgc.dart +++ b/lib/http/pgc.dart @@ -15,9 +15,9 @@ class PgcHttp { static Future> pgcIndexResult({ required int page, required Map params, - seasonType, - type, - indexType, + Object? seasonType, + Object? type, + Object? indexType, }) async { var res = await Request().get( Api.pgcIndexResult, @@ -38,15 +38,15 @@ class PgcHttp { } static Future> pgcIndexCondition({ - seasonType, - type, - indexType, + Object? seasonType, + required Object type, + Object? indexType, }) async { var res = await Request().get( Api.pgcIndexCondition, queryParameters: { 'season_type': ?seasonType, - 'type': ?type, + 'type': type, 'index_type': ?indexType, }, ); @@ -58,7 +58,7 @@ class PgcHttp { } static Future?>> pgcIndex({ - int? page, + required int page, int? indexType, }) async { var res = await Request().get( @@ -119,8 +119,8 @@ class PgcHttp { } static Future pgcReviewLike({ - required mediaId, - required reviewId, + required Object mediaId, + required Object reviewId, }) async { var res = await Request().post( Api.pgcReviewLike, @@ -140,8 +140,8 @@ class PgcHttp { } static Future pgcReviewDislike({ - required mediaId, - required reviewId, + required Object mediaId, + required Object reviewId, }) async { var res = await Request().post( Api.pgcReviewDislike, @@ -161,7 +161,7 @@ class PgcHttp { } static Future pgcReviewPost({ - required mediaId, + required Object mediaId, required int score, required String content, bool shareFeed = false, @@ -185,10 +185,10 @@ class PgcHttp { } static Future pgcReviewMod({ - required mediaId, + required Object mediaId, required int score, required String content, - required reviewId, + required Object reviewId, }) async { var res = await Request().post( Api.pgcReviewMod, @@ -209,8 +209,8 @@ class PgcHttp { } static Future pgcReviewDel({ - required mediaId, - required reviewId, + required Object mediaId, + required Object reviewId, }) async { var res = await Request().post( Api.pgcReviewDel, diff --git a/lib/http/reply.dart b/lib/http/reply.dart index 9a6cbc129..990092993 100644 --- a/lib/http/reply.dart +++ b/lib/http/reply.dart @@ -25,7 +25,7 @@ class ReplyHttp { required int page, int sort = 1, required bool antiGoodsReply, - bool? enableFilter, + // bool? enableFilter, }) async { var res = !isLogin ? await Request().get( @@ -248,9 +248,9 @@ class ReplyHttp { } static Future replyTop({ - required oid, - required type, - required rpid, + required Object oid, + required Object type, + required Object rpid, required bool isUpTop, }) async { var res = await Request().post( diff --git a/lib/http/search.dart b/lib/http/search.dart index 0a4a35a3c..e86dce6c1 100644 --- a/lib/http/search.dart +++ b/lib/http/search.dart @@ -43,7 +43,7 @@ class SearchHttp { static Future> searchByType({ required SearchType searchType, required String keyword, - required page, + required Object page, String? order, int? duration, int? tids, @@ -53,11 +53,11 @@ class SearchHttp { int? pubBegin, int? pubEnd, }) async { - var params = { + final params = { 'search_type': searchType.name, 'keyword': keyword, 'page': page, - if (order?.isNotEmpty == true) 'order': order, + if (order?.isNotEmpty == true) 'order': order!, 'duration': ?duration, 'tids': ?tids, 'order_sort': ?orderSort, @@ -107,7 +107,7 @@ class SearchHttp { static Future> searchAll({ required String keyword, - required page, + required Object page, String? order, int? duration, int? tids, @@ -117,10 +117,10 @@ class SearchHttp { int? pubBegin, int? pubEnd, }) async { - var params = { + final params = { 'keyword': keyword, 'page': page, - if (order?.isNotEmpty == true) 'order': order, + if (order?.isNotEmpty == true) 'order': order!, 'duration': ?duration, 'tids': ?tids, 'order_sort': ?orderSort, @@ -129,7 +129,7 @@ class SearchHttp { 'pubtime_begin_s': ?pubBegin, 'pubtime_end_s': ?pubEnd, }; - var res = await Request().get( + final res = await Request().get( Api.searchAll, queryParameters: params, ); @@ -148,7 +148,8 @@ class SearchHttp { } } - static Future ab2c({dynamic aid, dynamic bvid, int? part}) async { + static Future ab2c({Object? aid, Object? bvid, int? part}) async { + assert(aid != null || bvid != null); var res = await Request().get( Api.ab2c, queryParameters: { @@ -171,9 +172,10 @@ class SearchHttp { } static Future> pgcInfo({ - dynamic seasonId, - dynamic epId, + Object? seasonId, + Object? epId, }) async { + assert(seasonId != null || epId != null); var res = await Request().get( Api.pgcInfo, queryParameters: { @@ -189,9 +191,10 @@ class SearchHttp { } static Future> pugvInfo({ - dynamic seasonId, - dynamic epId, + Object? seasonId, + Object? epId, }) async { + assert(seasonId != null || epId != null); var res = await Request().get( Api.pugvInfo, queryParameters: { @@ -206,11 +209,11 @@ class SearchHttp { } } - static Future episodeInfo({dynamic epId}) async { + static Future episodeInfo({required Object epId}) async { var res = await Request().get( Api.episodeInfo, queryParameters: { - 'ep_id': ?epId, + 'ep_id': epId, }, ); if (res.data['code'] == 0) { diff --git a/lib/http/user.dart b/lib/http/user.dart index 002375470..7d8829fe5 100644 --- a/lib/http/user.dart +++ b/lib/http/user.dart @@ -150,7 +150,8 @@ class UserHttp { } // 稍后再看 - static Future toViewLater({String? bvid, dynamic aid}) async { + static Future toViewLater({String? bvid, Object? aid}) async { + assert(aid != null || bvid != null); var res = await Request().post( Api.toViewLater, data: { @@ -318,14 +319,14 @@ class UserHttp { // 稍后再看列表 static Future getMediaList({ - required dynamic type, - required bizId, + required Object type, + required Object bizId, required int ps, - dynamic oid, + Object? oid, int? otype, bool withCurrent = false, bool desc = true, - dynamic sortField = 1, + sortField = 1, bool direction = false, }) async { var res = await Request().get( @@ -361,8 +362,8 @@ class UserHttp { } static Future dynamicReport({ - required dynamic mid, - required dynamic dynId, + required Object mid, + required Object dynId, required int reasonType, String? reasonDesc, }) async { @@ -396,7 +397,7 @@ class UserHttp { } } - static Future spaceSettingMod(data) async { + static Future spaceSettingMod(Map data) async { final res = await Request().post( Api.spaceSettingMod, queryParameters: { diff --git a/lib/http/validate.dart b/lib/http/validate.dart index 69530ca0f..c7243c7b8 100644 --- a/lib/http/validate.dart +++ b/lib/http/validate.dart @@ -25,10 +25,10 @@ class ValidateHttp { } static Future gaiaVgateValidate({ - required challenge, - required seccode, - required token, - required validate, + required Object? challenge, + required Object? seccode, + required Object? token, + required Object? validate, }) async { final res = await Request().post( Api.gaiaVgateValidate, diff --git a/lib/http/video.dart b/lib/http/video.dart index c92bfaa52..2f3a829d4 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -39,7 +39,7 @@ class VideoHttp { static bool enableFilter = zoneRegExp.pattern.isNotEmpty; // 首页推荐视频 - static Future rcmdVideoList({ + static Future>> rcmdVideoList({ required int ps, required int freshIdx, }) async { @@ -75,7 +75,9 @@ class VideoHttp { } // 添加额外的loginState变量模拟未登录状态 - static Future rcmdVideoListApp({required int freshIdx}) async { + static Future>> rcmdVideoListApp({ + required int freshIdx, + }) async { final params = { 'build': 2001100, 'c_locale': 'zh_CN', @@ -191,8 +193,8 @@ class VideoHttp { String? bvid, required int cid, int? qn, - dynamic epid, - dynamic seasonId, + Object? epid, + Object? seasonId, required bool tryLook, required VideoType videoType, }) async { @@ -280,7 +282,7 @@ class VideoHttp { } } - static Future videoRelation({required dynamic bvid}) async { + static Future videoRelation({required String bvid}) async { var res = await Request().get( Api.videoRelation, queryParameters: { @@ -323,7 +325,7 @@ class VideoHttp { } // 获取点赞/投币/收藏状态 pgc - static Future pgcLikeCoinFav({dynamic epId}) async { + static Future pgcLikeCoinFav({required Object epId}) async { var res = await Request().get( Api.pgcLikeCoinFav, queryParameters: {'ep_id': epId}, @@ -360,7 +362,10 @@ class VideoHttp { } // 一键三连 pgc - static Future pgcTriple({dynamic epId, required dynamic seasonId}) async { + static Future pgcTriple({ + required Object epId, + Object? seasonId, + }) async { var res = await Request().post( Api.pgcTriple, data: { @@ -371,7 +376,10 @@ class VideoHttp { contentType: Headers.formUrlEncodedContentType, headers: { 'origin': 'https://www.bilibili.com', - 'referer': 'https://www.bilibili.com/bangumi/play/ss$seasonId', + if (seasonId != null) + 'referer': 'https://www.bilibili.com/bangumi/play/ss$seasonId', + if (seasonId == null) + 'referer': 'https://www.bilibili.com/bangumi/play/ep$epId', 'user-agent': UaType.pc.ua, }, ), @@ -627,7 +635,7 @@ class VideoHttp { } static Future roomEntryAction({ - roomId, + required Object roomId, }) async { await Request().post( Api.roomEntryAction, @@ -642,14 +650,14 @@ class VideoHttp { } static Future historyReport({ - aid, - type, + required Object aid, + required Object type, }) async { await Request().post( Api.historyReport, data: { - 'aid': ?aid, - 'type': ?type, + 'aid': aid, + 'type': type, 'csrf': Accounts.heartbeat.csrf, }, options: Options(contentType: Headers.formUrlEncodedContentType), @@ -658,13 +666,13 @@ class VideoHttp { // 视频播放进度 static Future heartBeat({ - aid, - bvid, - cid, - progress, - epid, - seasonId, - subType, + Object? aid, + Object? bvid, + required Object cid, + required Object progress, + Object? epid, + Object? seasonId, + Object? subType, required VideoType videoType, }) async { final isPugv = videoType == VideoType.pugv; @@ -686,8 +694,8 @@ class VideoHttp { static Future medialistHistory({ required int desc, - required dynamic oid, - required dynamic upperMid, + required Object oid, + required Object upperMid, }) async { await Request().post( Api.mediaListHistory, @@ -779,12 +787,13 @@ class VideoHttp { } // 查看视频同时在看人数 - static Future onlineTotal({int? aid, String? bvid, int? cid}) async { + static Future onlineTotal({int? aid, String? bvid, required int cid}) async { + assert(aid != null || bvid != null); var res = await Request().get( Api.onlineTotal, queryParameters: { - 'aid': aid, - 'bvid': bvid, + 'aid': ?aid, + 'bvid': ?bvid, 'cid': cid, }, ); @@ -796,14 +805,14 @@ class VideoHttp { } static Future aiConclusion({ - String? bvid, - int? cid, + required String bvid, + required int cid, int? upMid, }) async { final params = await WbiSign.makSign({ 'bvid': bvid, 'cid': cid, - 'up_mid': upMid, + 'up_mid': ?upMid, }); var res = await Request().get(Api.aiConclusion, queryParameters: params); if (res.data['code'] == 0 && res.data['data']['code'] == 0) { @@ -903,7 +912,7 @@ class VideoHttp { } // pgc 排行 - static Future pgcRankList({ + static Future?>> pgcRankList({ int day = 3, required int seasonType, }) async { @@ -926,7 +935,7 @@ class VideoHttp { } // pgc season 排行 - static Future pgcSeasonRankList({ + static Future?>> pgcSeasonRankList({ int day = 3, required int seasonType, }) async { @@ -949,8 +958,8 @@ class VideoHttp { } static Future> getVideoNoteList({ - dynamic oid, - dynamic uperMid, + required Object oid, + Object? uperMid, required int page, }) async { var res = await Request().get( diff --git a/lib/pages/article_list/controller.dart b/lib/pages/article_list/controller.dart index 89e58093f..660d8d515 100644 --- a/lib/pages/article_list/controller.dart +++ b/lib/pages/article_list/controller.dart @@ -9,7 +9,7 @@ import 'package:get/get.dart'; class ArticleListController extends CommonListController { - final id = Get.parameters['id']; + final id = Get.parameters['id']!; @override void onInit() { diff --git a/lib/pages/common/common_whisper_controller.dart b/lib/pages/common/common_whisper_controller.dart index 479228cb2..f386cbcad 100644 --- a/lib/pages/common/common_whisper_controller.dart +++ b/lib/pages/common/common_whisper_controller.dart @@ -12,7 +12,7 @@ abstract class CommonWhisperController extends CommonListController { SessionPageType get sessionPageType; - Future onRemove(int index, int? talkerId) async { + Future onRemove(int index, int talkerId) async { var res = await MsgHttp.removeMsg(talkerId); if (res['status']) { loadingState diff --git a/lib/pages/common/publish/common_rich_text_pub_page.dart b/lib/pages/common/publish/common_rich_text_pub_page.dart index b11f37bac..28d49c1be 100644 --- a/lib/pages/common/publish/common_rich_text_pub_page.dart +++ b/lib/pages/common/publish/common_rich_text_pub_page.dart @@ -182,7 +182,7 @@ abstract class CommonRichTextPubPageState ); } - void onChooseEmote(dynamic emote, double? width, double? height) { + void onChooseEmote(Object emote, double? width, double? height) { if (emote is e.Emote) { final isTextEmote = width == null; onInsertText( diff --git a/lib/pages/dynamics/widgets/additional_panel.dart b/lib/pages/dynamics/widgets/additional_panel.dart index efe543fb1..a0ea5f5c6 100644 --- a/lib/pages/dynamics/widgets/additional_panel.dart +++ b/lib/pages/dynamics/widgets/additional_panel.dart @@ -216,11 +216,11 @@ Widget addWidget( : () async { var res = await DynamicsHttp.dynReserve( - reserveId: reserve.rid, - curBtnStatus: btn.status, + reserveId: reserve.rid!, + curBtnStatus: btn.status!, dynamicIdStr: item.idStr, reserveTotal: - reserve.reserveTotal, + reserve.reserveTotal!, ); if (res['status']) { DynReserveData data = diff --git a/lib/pages/dynamics/widgets/author_panel.dart b/lib/pages/dynamics/widgets/author_panel.dart index 310be923d..a21cd00b4 100644 --- a/lib/pages/dynamics/widgets/author_panel.dart +++ b/lib/pages/dynamics/widgets/author_panel.dart @@ -29,7 +29,7 @@ class AuthorPanel extends StatelessWidget { final bool isDetail; final ValueChanged? onRemove; final bool isSave; - final Function(bool isTop, dynamic dynId)? onSetTop; + final Function(bool isTop, Object dynId)? onSetTop; final VoidCallback? onBlock; const AuthorPanel({ @@ -519,7 +519,7 @@ class AuthorPanel extends StatelessWidget { ); } return UserHttp.dynamicReport( - mid: item.modules.moduleAuthor!.mid, + mid: item.modules.moduleAuthor!.mid!, dynId: item.idStr, reasonType: reasonType, ); diff --git a/lib/pages/dynamics/widgets/dynamic_panel.dart b/lib/pages/dynamics/widgets/dynamic_panel.dart index a08df3998..80852b086 100644 --- a/lib/pages/dynamics/widgets/dynamic_panel.dart +++ b/lib/pages/dynamics/widgets/dynamic_panel.dart @@ -18,7 +18,7 @@ class DynamicPanel extends StatelessWidget { final ValueChanged? onRemove; final Function(List, int)? callback; final bool isSave; - final Function(bool isTop, dynamic dynId)? onSetTop; + final Function(bool isTop, Object dynId)? onSetTop; final VoidCallback? onBlock; const DynamicPanel({ diff --git a/lib/pages/dynamics/widgets/rich_node_panel.dart b/lib/pages/dynamics/widgets/rich_node_panel.dart index 2b1a7f03c..2390d7699 100644 --- a/lib/pages/dynamics/widgets/rich_node_panel.dart +++ b/lib/pages/dynamics/widgets/rich_node_panel.dart @@ -285,7 +285,7 @@ TextSpan? richNode( return; } - DynamicsHttp.dynPic(i.rid).then((res) { + DynamicsHttp.dynPic(i.rid!).then((res) { if (res.isSuccess) { var list = res.data; if (Platform.isAndroid) { diff --git a/lib/pages/dynamics_create_reserve/controller.dart b/lib/pages/dynamics_create_reserve/controller.dart index fbd79aad6..f85de9c57 100644 --- a/lib/pages/dynamics_create_reserve/controller.dart +++ b/lib/pages/dynamics_create_reserve/controller.dart @@ -28,7 +28,7 @@ class CreateReserveController extends GetxController { } Future queryData() async { - var res = await DynamicsHttp.reserveInfo(sid: sid); + var res = await DynamicsHttp.reserveInfo(sid: sid!); if (res.isSuccess) { ReserveInfoData data = res.data; key = Utils.generateRandomString(6); diff --git a/lib/pages/dynamics_create_vote/controller.dart b/lib/pages/dynamics_create_vote/controller.dart index aef0a09d9..2911a6a2c 100644 --- a/lib/pages/dynamics_create_vote/controller.dart +++ b/lib/pages/dynamics_create_vote/controller.dart @@ -58,7 +58,7 @@ class CreateVoteController extends GetxController { } Future queryData() async { - var res = await DynamicsHttp.voteInfo(voteId); + var res = await DynamicsHttp.voteInfo(voteId!); if (res.isSuccess) { key = Utils.generateRandomString(6); final VoteInfo data = res.data; diff --git a/lib/pages/dynamics_tab/controller.dart b/lib/pages/dynamics_tab/controller.dart index 8b1bf53f7..4153382a1 100644 --- a/lib/pages/dynamics_tab/controller.dart +++ b/lib/pages/dynamics_tab/controller.dart @@ -49,7 +49,7 @@ class DynamicsTabController tempBannedList: dynamicsController.tempBannedList, ); - Future onRemove(int index, dynamic dynamicId) async { + Future onRemove(int index, Object dynamicId) async { var res = await MsgHttp.removeDynamic(dynIdStr: dynamicId); if (res['status']) { loadingState diff --git a/lib/pages/episode_panel/view.dart b/lib/pages/episode_panel/view.dart index 27a59038b..e22f5bad3 100644 --- a/lib/pages/episode_panel/view.dart +++ b/lib/pages/episode_panel/view.dart @@ -513,7 +513,7 @@ class _EpisodePanelState extends CommonCollapseSlidePageState { onPressed: () async { var result = await FavHttp.seasonFav( isFav: response, - seasonId: widget.seasonId, + seasonId: widget.seasonId!, ); if (result['status']) { SmartDialog.showToast('${response ? '取消' : ''}订阅成功'); diff --git a/lib/pages/fav/article/controller.dart b/lib/pages/fav/article/controller.dart index 0c9d253a9..d4916ce54 100644 --- a/lib/pages/fav/article/controller.dart +++ b/lib/pages/fav/article/controller.dart @@ -25,7 +25,7 @@ class FavArticleController Future> customGetData() => FavHttp.favArticle(page: page); - Future onRemove(int index, String? id) async { + Future onRemove(int index, String id) async { final res = await FavHttp.communityAction(opusId: id, action: 4); if (res['status']) { loadingState diff --git a/lib/pages/fav/article/view.dart b/lib/pages/fav/article/view.dart index c7497d36d..6a8f811e4 100644 --- a/lib/pages/fav/article/view.dart +++ b/lib/pages/fav/article/view.dart @@ -66,7 +66,7 @@ class _FavArticlePageState extends State context: context, title: '确定取消收藏?', onConfirm: () => - _favArticleController.onRemove(index, item.opusId), + _favArticleController.onRemove(index, item.opusId!), ), ); }, diff --git a/lib/pages/fav/cheese/controller.dart b/lib/pages/fav/cheese/controller.dart index 87c2e4f07..b88cb2afc 100644 --- a/lib/pages/fav/cheese/controller.dart +++ b/lib/pages/fav/cheese/controller.dart @@ -26,7 +26,7 @@ class FavCheeseController Future> customGetData() => FavHttp.favPugv(mid: mid, page: page); - Future onRemove(int index, int? sid) async { + Future onRemove(int index, int sid) async { var res = await FavHttp.delFavPugv(sid); if (res['status']) { loadingState diff --git a/lib/pages/fav/cheese/view.dart b/lib/pages/fav/cheese/view.dart index 590a02304..1bd044368 100644 --- a/lib/pages/fav/cheese/view.dart +++ b/lib/pages/fav/cheese/view.dart @@ -68,7 +68,7 @@ class _FavCheesePageState extends State context: context, title: '确定取消收藏该课堂?', onConfirm: () => - _controller.onRemove(index, item.seasonId), + _controller.onRemove(index, item.seasonId!), ), ); }, diff --git a/lib/pages/fav/topic/controller.dart b/lib/pages/fav/topic/controller.dart index b864eb92e..954abd65e 100644 --- a/lib/pages/fav/topic/controller.dart +++ b/lib/pages/fav/topic/controller.dart @@ -38,7 +38,7 @@ class FavTopicController Future> customGetData() => FavHttp.favTopic(page: page); - Future onRemove(int index, int? id) async { + Future onRemove(int index, int id) async { var res = await FavHttp.delFavTopic(id); if (res['status']) { loadingState diff --git a/lib/pages/fav/topic/view.dart b/lib/pages/fav/topic/view.dart index e5555928d..c4cfcded4 100644 --- a/lib/pages/fav/topic/view.dart +++ b/lib/pages/fav/topic/view.dart @@ -93,7 +93,7 @@ class _FavTopicPageState extends State context: context, title: '确定取消收藏?', onConfirm: () { - _controller.onRemove(index, item.id); + _controller.onRemove(index, item.id!); }, ), borderRadius: const BorderRadius.all( diff --git a/lib/pages/follow/child/child_controller.dart b/lib/pages/follow/child/child_controller.dart index a07328c6d..dc0b31cba 100644 --- a/lib/pages/follow/child/child_controller.dart +++ b/lib/pages/follow/child/child_controller.dart @@ -48,7 +48,7 @@ class FollowChildController @override Future> customGetData() { if (tagid != null) { - return MemberHttp.followUpGroup(mid: mid, tagid: tagid, pn: page); + return MemberHttp.followUpGroup(mid: mid, tagid: tagid!, pn: page); } return FollowHttp.followings( diff --git a/lib/pages/follow/controller.dart b/lib/pages/follow/controller.dart index 728b7d34e..7857db213 100644 --- a/lib/pages/follow/controller.dart +++ b/lib/pages/follow/controller.dart @@ -70,7 +70,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin { } Future onUpdateTag(MemberTagItemModel item, String tagName) async { - final res = await MemberHttp.updateFollowTag(item.tagid, tagName); + final res = await MemberHttp.updateFollowTag(item.tagid!, tagName); if (res['status']) { item.name = tagName; tabs.refresh(); @@ -80,7 +80,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin { } } - Future onDelTag(int? tagid) async { + Future onDelTag(int tagid) async { final res = await MemberHttp.delFollowTag(tagid); if (res['status']) { followState.value = LoadingState.loading(); diff --git a/lib/pages/follow/view.dart b/lib/pages/follow/view.dart index ec7e738a6..6db480677 100644 --- a/lib/pages/follow/view.dart +++ b/lib/pages/follow/view.dart @@ -202,7 +202,7 @@ class _FollowPageState extends State { context: context, title: '删除分组', content: '删除后,该分组下的用户依旧保留?', - onConfirm: () => _followController.onDelTag(item.tagid), + onConfirm: () => _followController.onDelTag(item.tagid!), ); }, dense: true, diff --git a/lib/pages/live/controller.dart b/lib/pages/live/controller.dart index bd456a425..965711ca9 100644 --- a/lib/pages/live/controller.dart +++ b/lib/pages/live/controller.dart @@ -76,8 +76,8 @@ class LiveController extends CommonListController { return LiveHttp.liveSecondList( pn: page, isLogin: accountService.isLogin.value, - areaId: areaId, - parentAreaId: parentAreaId, + areaId: areaId!, + parentAreaId: parentAreaId!, sortType: sortType, ); } diff --git a/lib/pages/live_dm_block/controller.dart b/lib/pages/live_dm_block/controller.dart index 0d47a0ce2..bbece7372 100644 --- a/lib/pages/live_dm_block/controller.dart +++ b/lib/pages/live_dm_block/controller.dart @@ -36,7 +36,7 @@ class LiveDmBlockController extends GetxController } Future queryData() async { - var res = await LiveHttp.getLiveInfoByUser(roomId); + var res = await LiveHttp.getLiveInfoByUser(roomId!); if (res.isSuccess) { ShieldInfo? data = res.data; ShieldRules? shieldRules = data?.shieldRules; @@ -115,7 +115,7 @@ class LiveDmBlockController extends GetxController } else { var res = await LiveHttp.liveShieldUser( uid: value, - roomid: roomId, + roomid: roomId!, type: 1, ); if (res['status']) { @@ -132,11 +132,11 @@ class LiveDmBlockController extends GetxController } } - Future onRemove(int index, dynamic item) async { + Future onRemove(int index, Object item) async { if (item is ShieldUserList) { var res = await LiveHttp.liveShieldUser( - uid: item.uid, - roomid: roomId, + uid: item.uid!, + roomid: roomId!, type: 0, ); if (res['status']) { @@ -145,7 +145,7 @@ class LiveDmBlockController extends GetxController SmartDialog.showToast(res['msg']); } } else { - var res = await LiveHttp.delShieldKeyword(keyword: item); + var res = await LiveHttp.delShieldKeyword(keyword: item as String); if (res['status']) { keywordList.removeAt(index); } else { diff --git a/lib/pages/member_dynamics/controller.dart b/lib/pages/member_dynamics/controller.dart index 84da80837..70dd55f91 100644 --- a/lib/pages/member_dynamics/controller.dart +++ b/lib/pages/member_dynamics/controller.dart @@ -60,7 +60,7 @@ class MemberDynamicsController } } - Future onSetTop(bool isTop, dynamic dynamicId) async { + Future onSetTop(bool isTop, Object dynamicId) async { var res = isTop ? await DynamicsHttp.rmTop(dynamicId: dynamicId) : await DynamicsHttp.setTop(dynamicId: dynamicId); diff --git a/lib/pages/member_search/child/controller.dart b/lib/pages/member_search/child/controller.dart index 9b26c849c..3b8394a08 100644 --- a/lib/pages/member_search/child/controller.dart +++ b/lib/pages/member_search/child/controller.dart @@ -59,13 +59,13 @@ class MemberSearchChildController extends CommonListController { Future customGetData() { return switch (searchType) { MemberSearchType.archive => MemberHttp.searchArchive( - mid: controller.mid, + mid: controller.mid!, pn: page, keyword: controller.editingController.text, order: 'pubdate', ), MemberSearchType.dynamic => MemberHttp.dynSearch( - mid: controller.mid, + mid: controller.mid!, pn: page, offset: offset ?? '', keyword: controller.editingController.text, diff --git a/lib/pages/msg_feed_top/at_me/controller.dart b/lib/pages/msg_feed_top/at_me/controller.dart index b417b3630..c5c7ea6ec 100644 --- a/lib/pages/msg_feed_top/at_me/controller.dart +++ b/lib/pages/msg_feed_top/at_me/controller.dart @@ -36,7 +36,7 @@ class AtMeController extends CommonListController { Future> customGetData() => MsgHttp.msgFeedAtMe(cursor: cursor, cursorTime: cursorTime); - Future onRemove(dynamic id, int index) async { + Future onRemove(Object id, int index) async { try { var res = await MsgHttp.delMsgfeed(2, id); if (res['status']) { diff --git a/lib/pages/msg_feed_top/at_me/view.dart b/lib/pages/msg_feed_top/at_me/view.dart index e5e63362f..3a224ab1d 100644 --- a/lib/pages/msg_feed_top/at_me/view.dart +++ b/lib/pages/msg_feed_top/at_me/view.dart @@ -104,7 +104,8 @@ class _AtMePageState extends State { onLongPress: () => showConfirmDialog( context: context, title: '确定删除该通知?', - onConfirm: () => _atMeController.onRemove(item.id, index), + onConfirm: () => + _atMeController.onRemove(item.id!, index), ), leading: GestureDetector( onTap: () => Get.toNamed('/member?mid=${item.user?.mid}'), diff --git a/lib/pages/msg_feed_top/like_detail/controller.dart b/lib/pages/msg_feed_top/like_detail/controller.dart index b1f414981..0beb42d30 100644 --- a/lib/pages/msg_feed_top/like_detail/controller.dart +++ b/lib/pages/msg_feed_top/like_detail/controller.dart @@ -31,7 +31,7 @@ class LikeDetailController @override Future> customGetData() => MsgHttp.msgLikeDetail( - cardId: cardId, + cardId: cardId!, pn: page, ); } diff --git a/lib/pages/msg_feed_top/like_me/controller.dart b/lib/pages/msg_feed_top/like_me/controller.dart index 6c428dfeb..76042278e 100644 --- a/lib/pages/msg_feed_top/like_me/controller.dart +++ b/lib/pages/msg_feed_top/like_me/controller.dart @@ -63,7 +63,7 @@ class LikeMeController Future> customGetData() => MsgHttp.msgFeedLikeMe(cursor: cursor, cursorTime: cursorTime); - Future onRemove(dynamic id, int index, bool isLatest) async { + Future onRemove(Object id, int index, bool isLatest) async { try { var res = await MsgHttp.delMsgfeed(0, id); if (res['status']) { @@ -84,7 +84,10 @@ class LikeMeController Future onSetNotice(MsgLikeItem item, bool isNotice) async { int noticeState = isNotice ? 1 : 0; - var res = await MsgHttp.msgSetNotice(id: item.id, noticeState: noticeState); + var res = await MsgHttp.msgSetNotice( + id: item.id!, + noticeState: noticeState, + ); if (res['status']) { item.noticeState = noticeState; loadingState.refresh(); diff --git a/lib/pages/msg_feed_top/like_me/view.dart b/lib/pages/msg_feed_top/like_me/view.dart index ba0ee9a77..f1d2acb7f 100644 --- a/lib/pages/msg_feed_top/like_me/view.dart +++ b/lib/pages/msg_feed_top/like_me/view.dart @@ -160,7 +160,7 @@ class _LikeMePageState extends State { Widget _buildItem( ThemeData theme, MsgLikeItem item, - ValueChanged onRemove, + ValueChanged onRemove, ) { return ListTile( onTap: () { @@ -199,7 +199,7 @@ class _LikeMePageState extends State { context: context, title: '删除', content: '该条通知删除后,当有新点赞时会重新出现在列表,是否继续?', - onConfirm: () => onRemove(item.id), + onConfirm: () => onRemove(item.id!), ); }, dense: true, diff --git a/lib/pages/msg_feed_top/reply_me/controller.dart b/lib/pages/msg_feed_top/reply_me/controller.dart index 1b452e633..554690a76 100644 --- a/lib/pages/msg_feed_top/reply_me/controller.dart +++ b/lib/pages/msg_feed_top/reply_me/controller.dart @@ -37,7 +37,7 @@ class ReplyMeController Future> customGetData() => MsgHttp.msgFeedReplyMe(cursor: cursor, cursorTime: cursorTime); - Future onRemove(dynamic id, int index) async { + Future onRemove(Object id, int index) async { try { var res = await MsgHttp.delMsgfeed(1, id); if (res['status']) { diff --git a/lib/pages/msg_feed_top/reply_me/view.dart b/lib/pages/msg_feed_top/reply_me/view.dart index dc618b6c8..884ea8eb5 100644 --- a/lib/pages/msg_feed_top/reply_me/view.dart +++ b/lib/pages/msg_feed_top/reply_me/view.dart @@ -110,7 +110,7 @@ class _ReplyMePageState extends State { context: context, title: '确定删除该通知?', onConfirm: () => - _replyMeController.onRemove(item.id, index), + _replyMeController.onRemove(item.id!, index), ), leading: GestureDetector( onTap: () => Get.toNamed('/member?mid=${item.user?.mid}'), diff --git a/lib/pages/msg_feed_top/sys_msg/controller.dart b/lib/pages/msg_feed_top/sys_msg/controller.dart index 1d50e5983..6f8e0524b 100644 --- a/lib/pages/msg_feed_top/sys_msg/controller.dart +++ b/lib/pages/msg_feed_top/sys_msg/controller.dart @@ -34,7 +34,7 @@ class SysMsgController return super.onRefresh(); } - Future onRemove(dynamic id, int index) async { + Future onRemove(Object id, int index) async { try { var res = await MsgHttp.delSysMsg(id); if (res['status']) { diff --git a/lib/pages/msg_feed_top/sys_msg/view.dart b/lib/pages/msg_feed_top/sys_msg/view.dart index 71669eef4..05835b685 100644 --- a/lib/pages/msg_feed_top/sys_msg/view.dart +++ b/lib/pages/msg_feed_top/sys_msg/view.dart @@ -83,7 +83,7 @@ class _SysMsgPageState extends State { context: context, title: '确定删除该通知?', onConfirm: () => - _sysMsgController.onRemove(item.id, index), + _sysMsgController.onRemove(item.id!, index), ), title: Text( "${item.title}", diff --git a/lib/pages/pgc_review/child/controller.dart b/lib/pages/pgc_review/child/controller.dart index b49204c51..cca6a7071 100644 --- a/lib/pages/pgc_review/child/controller.dart +++ b/lib/pages/pgc_review/child/controller.dart @@ -101,7 +101,7 @@ class PgcReviewController } } - Future onDel(int index, int? reviewId) async { + Future onDel(int index, int reviewId) async { var res = await PgcHttp.pgcReviewDel( mediaId: mediaId, reviewId: reviewId, diff --git a/lib/pages/pgc_review/child/view.dart b/lib/pages/pgc_review/child/view.dart index 053ce55f1..edafc76ac 100644 --- a/lib/pages/pgc_review/child/view.dart +++ b/lib/pages/pgc_review/child/view.dart @@ -170,7 +170,7 @@ class _PgcReviewChildPageState extends State context: context, title: '删除短评,同时删除评分?', onConfirm: () => - _controller.onDel(index, item.reviewId), + _controller.onDel(index, item.reviewId!), ); }, ), diff --git a/lib/pages/rank/zone/controller.dart b/lib/pages/rank/zone/controller.dart index 1a5ceae0d..4a52b21b2 100644 --- a/lib/pages/rank/zone/controller.dart +++ b/lib/pages/rank/zone/controller.dart @@ -15,7 +15,7 @@ class ZoneController extends CommonListController { } @override - Future customGetData() { + Future> customGetData() { if (rid != null) { return VideoHttp.getRankVideoList(rid!); } diff --git a/lib/pages/rcmd/controller.dart b/lib/pages/rcmd/controller.dart index 54c777cc2..8650d0131 100644 --- a/lib/pages/rcmd/controller.dart +++ b/lib/pages/rcmd/controller.dart @@ -1,9 +1,15 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/video.dart'; +import 'package:PiliPlus/models/model_rec_video_item.dart'; import 'package:PiliPlus/pages/common/common_list_controller.dart'; import 'package:PiliPlus/utils/storage_pref.dart'; -class RcmdController extends CommonListController { +class RcmdController + extends + CommonListController< + List, + BaseRecVideoItemModel + > { late bool enableSaveLastData = Pref.enableSaveLastData; final bool appRcmd = Pref.appRcmd; @@ -18,16 +24,16 @@ class RcmdController extends CommonListController { } @override - Future customGetData() { + Future>> customGetData() { return appRcmd ? VideoHttp.rcmdVideoListApp(freshIdx: page) : VideoHttp.rcmdVideoList(freshIdx: page, ps: 20); } @override - void handleListResponse(List dataList) { + void handleListResponse(List dataList) { if (enableSaveLastData && page == 0 && loadingState.value.isSuccess) { - List? currentList = loadingState.value.data; + final currentList = loadingState.value.data; if (currentList?.isNotEmpty == true) { if (savedRcmdTip) { lastRefreshAt = dataList.length; diff --git a/lib/pages/rcmd/view.dart b/lib/pages/rcmd/view.dart index c371e5a0b..9c24318c2 100644 --- a/lib/pages/rcmd/view.dart +++ b/lib/pages/rcmd/view.dart @@ -4,6 +4,7 @@ import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; import 'package:PiliPlus/common/widgets/video_card/video_card_v.dart'; import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/models/model_rec_video_item.dart'; import 'package:PiliPlus/pages/common/common_page.dart'; import 'package:PiliPlus/pages/rcmd/controller.dart'; import 'package:PiliPlus/utils/grid.dart'; @@ -59,7 +60,7 @@ class _RcmdPageState extends CommonPageState mainAxisExtent: MediaQuery.textScalerOf(context).scale(90), ); - Widget _buildBody(LoadingState?> loadingState) { + Widget _buildBody(LoadingState?> loadingState) { return switch (loadingState) { Loading() => _buildSkeleton, Success(:var response) => diff --git a/lib/pages/save_panel/view.dart b/lib/pages/save_panel/view.dart index d2baee123..aad43359f 100644 --- a/lib/pages/save_panel/view.dart +++ b/lib/pages/save_panel/view.dart @@ -15,6 +15,7 @@ import 'package:PiliPlus/utils/context_ext.dart'; import 'package:PiliPlus/utils/date_util.dart'; import 'package:PiliPlus/utils/image_util.dart'; import 'package:PiliPlus/utils/utils.dart'; +import 'package:fixnum/fixnum.dart'; import 'package:flutter/foundation.dart' show kDebugMode; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -33,13 +34,13 @@ class SavePanel extends StatefulWidget { super.key, }); - final dynamic upMid; - final dynamic item; + final Int64? upMid; + final Object item; @override State createState() => _SavePanelState(); - static void toSavePanel({dynamic upMid, dynamic item}) { + static void toSavePanel({Int64? upMid, required Object item}) { Get.generalDialog( barrierLabel: '', barrierDismissible: true, diff --git a/lib/pages/setting/pages/color_select.dart b/lib/pages/setting/pages/color_select.dart index a278b926d..fa177444d 100644 --- a/lib/pages/setting/pages/color_select.dart +++ b/lib/pages/setting/pages/color_select.dart @@ -167,7 +167,7 @@ class _ColorSelectPageState extends State { value: 0, title: const Text('动态取色'), groupValue: ctr.type.value, - onChanged: (dynamic val) { + onChanged: (val) { ctr ..type.value = 0 ..setting.put(SettingBoxKey.dynamicColor, true); @@ -180,7 +180,7 @@ class _ColorSelectPageState extends State { value: 1, title: const Text('指定颜色'), groupValue: ctr.type.value, - onChanged: (dynamic val) { + onChanged: (val) { ctr ..type.value = 1 ..setting.put(SettingBoxKey.dynamicColor, false); diff --git a/lib/pages/setting/widgets/select_dialog.dart b/lib/pages/setting/widgets/select_dialog.dart index ba292fe6f..770a8576e 100644 --- a/lib/pages/setting/widgets/select_dialog.dart +++ b/lib/pages/setting/widgets/select_dialog.dart @@ -177,7 +177,7 @@ class _CdnSelectDialogState extends State { _cdnResList[index].value = '${speed}MB/s'; } - void _handleSpeedTestError(dynamic error, int index) { + void _handleSpeedTestError(Object error, int index) { final item = _cdnResList[index]; if (item.value != null) return; diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index 026150621..e6abbb2ca 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -826,7 +826,7 @@ class VideoDetailController extends GetxController } } - void onAddItem(dynamic item) { + void onAddItem(Object item) { if (listData.contains(item)) return; listData.insert(0, item); listKey.currentState?.insertItem(0); @@ -1446,7 +1446,7 @@ class VideoDetailController extends GetxController '/x/stein/edgeinfo_v2', queryParameters: { 'bvid': bvid, - 'graph_version': graphVersion, + 'graph_version': ?graphVersion, 'edge_id': ?edgeId, }, ); diff --git a/lib/pages/video/introduction/pgc/controller.dart b/lib/pages/video/introduction/pgc/controller.dart index e0f4cf2f0..6f57f0fa2 100644 --- a/lib/pages/video/introduction/pgc/controller.dart +++ b/lib/pages/video/introduction/pgc/controller.dart @@ -78,7 +78,7 @@ class PgcIntroController extends CommonIntroController { // 获取点赞/投币/收藏状态 Future queryPgcLikeCoinFav() async { - var result = await VideoHttp.pgcLikeCoinFav(epId: epId); + var result = await VideoHttp.pgcLikeCoinFav(epId: epId!); if (result['status']) { PgcLCF data = result['data']; final hasLike = data.like == 1; @@ -424,7 +424,7 @@ class PgcIntroController extends CommonIntroController { SmartDialog.showToast('已三连'); return; } - var result = await VideoHttp.pgcTriple(epId: epId, seasonId: seasonId); + var result = await VideoHttp.pgcTriple(epId: epId!, seasonId: seasonId); if (result['status']) { PgcTriple data = result['data']; late final stat = pgcItem.stat!; @@ -494,8 +494,8 @@ class PgcIntroController extends CommonIntroController { Future onFavPugv(bool isFav) async { final res = isFav - ? await FavHttp.delFavPugv(seasonId) - : await FavHttp.addFavPugv(seasonId); + ? await FavHttp.delFavPugv(seasonId!) + : await FavHttp.addFavPugv(seasonId!); if (res['status']) { this.isFav.value = !isFav; SmartDialog.showToast('${isFav ? '取消' : ''}收藏成功'); diff --git a/lib/pages/video/member/view.dart b/lib/pages/video/member/view.dart index b3b1eca38..a8a2b81d6 100644 --- a/lib/pages/video/member/view.dart +++ b/lib/pages/video/member/view.dart @@ -366,7 +366,7 @@ class _HorizontalMemberPageState extends State Widget _buildChildInfo({ required ThemeData theme, required String title, - required dynamic num, + required Object num, required VoidCallback onTap, }) { return GestureDetector( diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index fbd55870f..02016ed06 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -2132,8 +2132,8 @@ class _VideoDetailPageVState extends State } void onReversePlay({ - required dynamic bvid, - required dynamic aid, + required Object bvid, + required Object aid, required bool isSeason, }) { if (isSeason && videoDetailController.isPlayAll) { diff --git a/lib/pages/whisper/widgets/item.dart b/lib/pages/whisper/widgets/item.dart index abcce5568..2f3a3c4bd 100644 --- a/lib/pages/whisper/widgets/item.dart +++ b/lib/pages/whisper/widgets/item.dart @@ -26,7 +26,7 @@ class WhisperSessionItem extends StatelessWidget { final Session item; final Function(bool isTop, SessionId id) onSetTop; final Function(bool isMuted, Int64 talkerUid) onSetMute; - final ValueChanged onRemove; + final ValueChanged onRemove; @override Widget build(BuildContext context) { diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index d6d8fddb3..1baaeee35 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -61,7 +61,7 @@ class ChatItem extends StatelessWidget { late final Color textColor = isOwner ? theme.colorScheme.onSecondaryContainer : theme.colorScheme.onSurfaceVariant; - late final dynamic content = jsonDecode(item.content); + late final Map content = jsonDecode(item.content); return isRevoke ? const SizedBox.shrink() @@ -162,7 +162,7 @@ class ChatItem extends StatelessWidget { Widget messageContent({ required BuildContext context, required ThemeData theme, - required dynamic content, + required Map content, required Color textColor, }) { try { @@ -196,7 +196,10 @@ class ChatItem extends StatelessWidget { } } - Widget msgTypeCommonShareCard_14(dynamic content, Color textColor) { + Widget msgTypeCommonShareCard_14( + Map content, + Color textColor, + ) { if (content['source'] == '直播') { return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -242,7 +245,7 @@ class ChatItem extends StatelessWidget { } } - Widget msgTypeArticleCard_12(dynamic content, Color textColor) { + Widget msgTypeArticleCard_12(Map content, Color textColor) { return GestureDetector( onTap: () => Get.toNamed( '/articlePage', @@ -472,7 +475,7 @@ class ChatItem extends StatelessWidget { ); } - Widget msgTypeShareV2_7(dynamic content, Color textColor) { + Widget msgTypeShareV2_7(Map content, Color textColor) { String? type; GestureTapCallback onTap; switch (content['source']) { @@ -587,7 +590,7 @@ class ChatItem extends StatelessWidget { ); } - Widget msgTypePic_2(content) { + Widget msgTypePic_2(Map content) { final url = content['url']; return GestureDetector( onTap: () => PageUtils.imageView(imgList: [SourceModel(url: url)]), @@ -619,7 +622,7 @@ class ChatItem extends StatelessWidget { Widget msgTypeText_1( ThemeData theme, { - required dynamic content, + required Map content, required Color textColor, }) { final style = TextStyle(color: textColor, letterSpacing: 0.6, height: 1.5); @@ -764,7 +767,7 @@ class ChatItem extends StatelessWidget { ); } - Widget msgTypePictureCard_13(dynamic content) { + Widget msgTypePictureCard_13(Map content) { final url = content['jump_url']; return Center( child: ConstrainedBox( diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index c7a6d9ac6..c4327e469 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -1430,12 +1430,12 @@ class PlPlayerController { int progress, { HeartBeatType type = HeartBeatType.playing, bool isManual = false, - dynamic aid, - dynamic bvid, - dynamic cid, - dynamic epid, - dynamic seasonId, - dynamic pgcType, + Object? aid, + Object? bvid, + Object? cid, + Object? epid, + Object? seasonId, + Object? pgcType, VideoType? videoType, }) async { if (isLive) { @@ -1460,7 +1460,7 @@ class PlPlayerController { await VideoHttp.heartBeat( aid: aid ?? _aid, bvid: bvid ?? _bvid, - cid: cid ?? _cid, + cid: cid ?? _cid!, progress: isComplete ? -1 : progress, epid: epid ?? _epid, seasonId: seasonId ?? _seasonId, @@ -1475,7 +1475,7 @@ class PlPlayerController { await VideoHttp.heartBeat( aid: aid ?? _aid, bvid: bvid ?? _bvid, - cid: cid ?? _cid, + cid: cid ?? _cid!, progress: progress, epid: epid ?? _epid, seasonId: seasonId ?? _seasonId, @@ -1633,8 +1633,8 @@ class PlPlayerController { '/x/player/videoshot', queryParameters: { // 'aid': IdUtils.bv2av(_bvid), - 'bvid': _bvid, - 'cid': _cid, + 'bvid': _bvid!, + 'cid': _cid!, 'index': 1, }, options: Options( diff --git a/lib/services/audio_handler.dart b/lib/services/audio_handler.dart index 7e4455c77..81eb8957a 100644 --- a/lib/services/audio_handler.dart +++ b/lib/services/audio_handler.dart @@ -115,7 +115,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler { } void onVideoDetailChange( - dynamic data, + Object data, int cid, String herotag, { String? artist, @@ -127,7 +127,6 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler { // debugPrint(StackTrace.current); // } if (!PlPlayerController.instanceExists()) return; - if (data == null) return; late final id = '$cid$herotag'; MediaItem? mediaItem; diff --git a/lib/utils/accounts/account_manager/account_mgr.dart b/lib/utils/accounts/account_manager/account_mgr.dart index 8c3977ab9..715eed01e 100644 --- a/lib/utils/accounts/account_manager/account_mgr.dart +++ b/lib/utils/accounts/account_manager/account_mgr.dart @@ -133,11 +133,9 @@ class AccountManager extends Interceptor { // if (kDebugMode) debugPrint('is app: ${options.path}'); // bytes是grpc响应 if (options.responseType != ResponseType.bytes) { - final dataPtr = - (options.method == 'POST' && options.data is Map - ? options.data as Map - : options.queryParameters) - .cast(); + final dataPtr = (options.method == 'POST' && options.data is Map + ? (options.data as Map).cast() + : options.queryParameters); if (dataPtr.isNotEmpty) { if (!account.accessKey.isNullOrEmpty) { dataPtr['access_key'] = account.accessKey!; diff --git a/lib/utils/page_utils.dart b/lib/utils/page_utils.dart index 06e44e530..e9ffcd67d 100644 --- a/lib/utils/page_utils.dart +++ b/lib/utils/page_utils.dart @@ -294,7 +294,11 @@ class PageUtils { ); } - static Future pushDynFromId({id, rid, bool off = false}) async { + static Future pushDynFromId({ + String? id, + Object? rid, + bool off = false, + }) async { SmartDialog.showLoading(); var res = await DynamicsHttp.dynamicDetail( id: id, @@ -308,7 +312,7 @@ class PageUtils { toDupNamed( '/articlePage', parameters: { - 'id': id, + 'id': id!, 'type': 'opus', }, off: off, @@ -780,7 +784,7 @@ class PageUtils { static EpisodeItem findEpisode( List episodes, { - dynamic epId, + Object? epId, bool isPgc = true, }) { // epId episode -> progress episode -> first episode @@ -795,8 +799,8 @@ class PageUtils { } static Future viewPgc({ - dynamic seasonId, - dynamic epId, + Object? seasonId, + Object? epId, String? progress, }) async { try { @@ -884,8 +888,8 @@ class PageUtils { } static Future viewPugv({ - dynamic seasonId, - dynamic epId, + Object? seasonId, + Object? epId, int? aid, }) async { try { diff --git a/lib/utils/reply_utils.dart b/lib/utils/reply_utils.dart index 6b7b8b175..75aa003c0 100644 --- a/lib/utils/reply_utils.dart +++ b/lib/utils/reply_utils.dart @@ -54,11 +54,11 @@ class ReplyUtils { required int type, required int id, required String message, - dynamic root, - dynamic parent, - dynamic ctime, + required int root, + Object? parent, + Object? ctime, List? pictures, - dynamic mid, + Object? mid, bool isManual = false, required bool biliSendCommAntifraud, required sourceId, @@ -144,7 +144,6 @@ class ReplyUtils { type: type, sort: ReplySortType.time.index, page: 1, - enableFilter: false, antiGoodsReply: false, ); diff --git a/lib/utils/request_utils.dart b/lib/utils/request_utils.dart index 1f92a3312..c211a1fee 100644 --- a/lib/utils/request_utils.dart +++ b/lib/utils/request_utils.dart @@ -105,14 +105,11 @@ class RequestUtils { static Future actionRelationMod({ required BuildContext context, - required dynamic mid, + required int mid, required bool isFollow, required ValueChanged? callback, Map? followStatus, }) async { - if (mid == null) { - return; - } feedBack(); if (!isFollow) { var res = await VideoHttp.relationMod( @@ -283,23 +280,21 @@ class RequestUtils { // } // } - static Future insertCreatedDyn(dynamic id) async { + static Future insertCreatedDyn(Object id) async { try { - if (id != null) { - await Future.delayed(const Duration(milliseconds: 200)); - var res = await DynamicsHttp.dynamicDetail(id: id); - if (res['status']) { - final ctr = Get.find(tag: 'all'); - if (ctr.loadingState.value.isSuccess) { - List? list = ctr.loadingState.value.data; - if (list != null) { - list.insert(0, res['data']); - ctr.loadingState.refresh(); - return; - } + await Future.delayed(const Duration(milliseconds: 200)); + var res = await DynamicsHttp.dynamicDetail(id: id); + if (res['status']) { + final ctr = Get.find(tag: 'all'); + if (ctr.loadingState.value.isSuccess) { + List? list = ctr.loadingState.value.data; + if (list != null) { + list.insert(0, res['data']); + ctr.loadingState.refresh(); + return; } - ctr.loadingState.value = Success([res['data']]); } + ctr.loadingState.value = Success([res['data']]); } } catch (e) { if (kDebugMode) debugPrint('create dyn $e'); @@ -307,7 +302,7 @@ class RequestUtils { } static Future checkCreatedDyn({ - dynamic id, + Object? id, String? dynText, bool isManual = false, }) async { @@ -386,8 +381,8 @@ class RequestUtils { required BuildContext context, required bool isCopy, required MultiSelectController ctr, - required dynamic mediaId, - required dynamic mid, + required Object? mediaId, + required Object mid, }) { FavHttp.allFavFolders(mid).then((res) { if (context.mounted && res.dataOrNull?.list?.isNotEmpty == true) { @@ -439,7 +434,7 @@ class RequestUtils { isCopy: isCopy, isFav: ctr is! LaterController, srcMediaId: mediaId, - tarMediaId: checkedId, + tarMediaId: checkedId!, resources: removeList .map( (item) => ctr is LaterController diff --git a/lib/utils/update.dart b/lib/utils/update.dart index d73071d11..6365464d5 100644 --- a/lib/utils/update.dart +++ b/lib/utils/update.dart @@ -111,7 +111,7 @@ class Update { } // 下载适用于当前系统的安装包 - static Future onDownload(data) async { + static Future onDownload(Map data) async { SmartDialog.dismiss(); try { void download(plat) { diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index c8123cfa5..c02ec5592 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -100,7 +100,7 @@ class Utils { } } - static String makeHeroTag(v) { + static String makeHeroTag(Object? v) { return v.toString() + random.nextInt(9999).toString(); } diff --git a/lib/utils/wbi_sign.dart b/lib/utils/wbi_sign.dart index 89010d8eb..d082092b8 100644 --- a/lib/utils/wbi_sign.dart +++ b/lib/utils/wbi_sign.dart @@ -58,7 +58,7 @@ class WbiSign { } // 为请求参数进行 wbi 签名 - static void encWbi(Map params, String mixinKey) { + static void encWbi(Map params, String mixinKey) { params['wts'] = DateTime.now().millisecondsSinceEpoch ~/ 1000; // 按照 key 重排参数 final List keys = params.keys.toList()..sort(); @@ -104,8 +104,8 @@ class WbiSign { } } - static Future> makSign( - Map params, + static Future> makSign( + Map params, ) async { // params 为需要加密的请求参数 final String mixinKey = await lock.synchronized(getWbiKeys);