基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
eliminate all implicitly declared dynamic variable
Predidit19a7ff43126f
diff --git a/lib/pages/favorite/favorite_controller.dart b/lib/pages/favorite/favorite_controller.dartindex 63541eb2..096f5ab4 100644--- a/lib/pages/favorite/favorite_controller.dart+++ b/lib/pages/favorite/favorite_controller.dart@@ -21,7 +21,7 @@ abstract class _FavoriteController with Store {return !(GStorage.favorites.get(bangumiItem.id) == null);}- Future addFavorite(BangumiItem bangumiItem) async {+ Future<void> addFavorite(BangumiItem bangumiItem) async {await GStorage.favorites.put(bangumiItem.id, bangumiItem);await GStorage.favorites.flush();bool webDavEnable = await setting.get(SettingBoxKey.webDavEnable, defaultValue: false);@@ -35,7 +35,7 @@ abstract class _FavoriteController with Store {}}- Future deleteFavorite(BangumiItem bangumiItem) async {+ Future<void> deleteFavorite(BangumiItem bangumiItem) async {await GStorage.favorites.delete(bangumiItem.id);await GStorage.favorites.flush();bool webDavEnable = await setting.get(SettingBoxKey.webDavEnable, defaultValue: false);@@ -49,7 +49,7 @@ abstract class _FavoriteController with Store {}}- Future updateFavorite() async{+ Future<void> updateFavorite() async{KazumiLogger().log(Level.debug, '提交到WebDav的追番列表长度 ${GStorage.favorites.length}');await WebDav().updateFavorite();}diff --git a/lib/pages/info/info_controller.dart b/lib/pages/info/info_controller.dartindex 95ec8630..8e0f8c27 100644--- a/lib/pages/info/info_controller.dart+++ b/lib/pages/info/info_controller.dart@@ -59,13 +59,13 @@ abstract class _InfoController with Store {// }// }- queryBangumiSummaryByID(int id) async {+ Future<void> queryBangumiSummaryByID(int id) async {await BangumiHTTP.getBangumiSummaryByID(id).then((value) {bangumiItem.summary = value;});}- queryRoads(String url, String pluginName) async {+ Future<void> queryRoads(String url, String pluginName) async {final PluginsController pluginsController =Modular.get<PluginsController>();final VideoPageController videoPageController =@@ -83,7 +83,7 @@ abstract class _InfoController with Store {Level.info, '第一播放列表选集数 ${videoPageController.roadList[0].data.length}');}- queryBangumiCommentsByID(int id, {int offset = 0}) async {+ Future<void> queryBangumiCommentsByID(int id, {int offset = 0}) async {if (offset == 0) {commentsList.clear();}@@ -93,7 +93,7 @@ abstract class _InfoController with Store {KazumiLogger().log(Level.info, '已加载评论列表长度 ${commentsList.length}');}- queryBangumiEpisodeCommentsByID(int id, int episode) async {+ Future<void> queryBangumiEpisodeCommentsByID(int id, int episode) async {episodeCommentsList.clear();episodeInfo = await BangumiHTTP.getBangumiEpisodeByID(id, episode);await BangumiHTTP.getBangumiCommentsByEpisodeID(episodeInfo.id).then((value) {@@ -102,7 +102,7 @@ abstract class _InfoController with Store {KazumiLogger().log(Level.info, '已加载评论列表长度 ${episodeCommentsList.length}');}- queryBangumiCharactersByID(int id) async {+ Future<void> queryBangumiCharactersByID(int id) async {characterList.clear();await BangumiHTTP.getCharatersByID(id).then((value) {characterList.addAll(value.characterList);diff --git a/lib/pages/info/info_page.dart b/lib/pages/info/info_page.dartindex 445e0e80..34b6d66e 100644--- a/lib/pages/info/info_page.dart+++ b/lib/pages/info/info_page.dart@@ -57,7 +57,7 @@ class _InfoPageState extends State<InfoPage>/// workaround for bangumi calendar api/// bangumi calendar api always return empty summary- queryBangumiSummaryByID(int id) async {+ Future<void> queryBangumiSummaryByID(int id) async {try {await infoController.queryBangumiSummaryByID(id);setState(() {});diff --git a/lib/pages/player/player_controller.dart b/lib/pages/player/player_controller.dartindex e02db2c1..8561e293 100644--- a/lib/pages/player/player_controller.dart+++ b/lib/pages/player/player_controller.dart@@ -61,7 +61,7 @@ abstract class _PlayerController with Store {Box setting = GStorage.setting;late bool hAenable;- Future init({int offset = 0}) async {+ Future<void> init({int offset = 0}) async {playing = false;loading = true;isBuffering = true;@@ -125,7 +125,7 @@ abstract class _PlayerController with Store {return mediaPlayer;}- Future setPlaybackSpeed(double playerSpeed) async {+ Future<void> setPlaybackSpeed(double playerSpeed) async {this.playerSpeed = playerSpeed;try {mediaPlayer.setPlaybackSpeed(playerSpeed);@@ -134,7 +134,7 @@ abstract class _PlayerController with Store {}}- Future playOrPause() async {+ Future<void> playOrPause() async {if (mediaPlayer.value.isPlaying) {await pause();} else {@@ -142,24 +142,24 @@ abstract class _PlayerController with Store {}}- Future seek(Duration duration) async {+ Future<void> seek(Duration duration) async {danmakuController.clear();await mediaPlayer.seekTo(duration);}- Future pause() async {+ Future<void> pause() async {danmakuController.pause();await mediaPlayer.pause();playing = false;}- Future play() async {+ Future<void> play() async {danmakuController.resume();await mediaPlayer.play();playing = true;}- Future getDanDanmaku(String title, int episode) async {+ Future<void> getDanDanmaku(String title, int episode) async {KazumiLogger().log(Level.info, '尝试获取弹幕 $title');try {danDanmakus.clear();@@ -171,7 +171,7 @@ abstract class _PlayerController with Store {}}- Future getDanDanmakuByEpisodeID(int episodeID) async {+ Future<void> getDanDanmakuByEpisodeID(int episodeID) async {KazumiLogger().log(Level.info, '尝试获取弹幕 $episodeID');try {danDanmakus.clear();diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dartindex 40eb6d47..c2405fd6 100644--- a/lib/pages/player/player_item.dart+++ b/lib/pages/player/player_item.dart@@ -222,7 +222,7 @@ class _PlayerItemState extends State<PlayerItem>});}- getPlayerTimer() {+ Timer getPlayerTimer() {return Timer.periodic(const Duration(seconds: 1), (timer) {playerController.playing = playerController.mediaPlayer.value.isPlaying;playerController.isBuffering = playerController.mediaPlayer.value.isBuffering;diff --git a/lib/pages/plugin_editor/plugin_view_page.dart b/lib/pages/plugin_editor/plugin_view_page.dartindex 5a72d09d..64007aa8 100644--- a/lib/pages/plugin_editor/plugin_view_page.dart+++ b/lib/pages/plugin_editor/plugin_view_page.dart@@ -18,7 +18,7 @@ class PluginViewPage extends StatefulWidget {class _PluginViewPageState extends State<PluginViewPage> {final PluginsController pluginsController = Modular.get<PluginsController>();- _handleAdd() {+ void _handleAdd() {SmartDialog.show(animationTime: const Duration(milliseconds: 100),builder: (context) {@@ -61,7 +61,7 @@ class _PluginViewPageState extends State<PluginViewPage> {});}- _showInputDialog() {+ void _showInputDialog() {final TextEditingController textController = TextEditingController();SmartDialog.show(animationTime: const Duration(milliseconds: 100),diff --git a/lib/pages/popular/popular_controller.dart b/lib/pages/popular/popular_controller.dartindex 499dc9b5..3cc131da 100644--- a/lib/pages/popular/popular_controller.dart+++ b/lib/pages/popular/popular_controller.dart@@ -21,7 +21,7 @@ abstract class _PopularController with Store {double scrollOffset = 0.0;bool isLoadingMore = false;- Future queryBangumiListFeed({String type = 'init', String tag = ''}) async {+ Future<void> queryBangumiListFeed({String type = 'init', String tag = ''}) async {isLoadingMore = true;var random = Random();int randomNumber = random.nextInt(1000) + 1;@@ -33,7 +33,7 @@ abstract class _PopularController with Store {isLoadingMore = false;}- Future queryBangumi(String keyword) async {+ Future<void> queryBangumi(String keyword) async {isLoadingMore = true;var result = await BangumiHTTP.bangumiSearch(keyword);bangumiList.clear();diff --git a/lib/pages/settings/player_settings.dart b/lib/pages/settings/player_settings.dartindex b7edebbb..d605f781 100644--- a/lib/pages/settings/player_settings.dart+++ b/lib/pages/settings/player_settings.dart@@ -38,7 +38,7 @@ class _PlayerSettingsPageState extends State<PlayerSettingsPage> {});}- updateFvp() async {+ void updateFvp() async {bool hAenable =await setting.get(SettingBoxKey.hAenable, defaultValue: true);bool lowMemoryMode =diff --git a/lib/pages/timeline/timeline_controller.dart b/lib/pages/timeline/timeline_controller.dartindex b2c982e9..4de546c1 100644--- a/lib/pages/timeline/timeline_controller.dart+++ b/lib/pages/timeline/timeline_controller.dart@@ -16,11 +16,11 @@ abstract class _TimelineController with Store {DateTime selectedDate = DateTime.now();- Future getSchedules() async {+ Future<void> getSchedules() async {bangumiCalendar = await BangumiHTTP.getCalendar();}- Future getSchedulesBySeason() async {+ Future<void> getSchedulesBySeason() async {bangumiCalendar = await BangumiHTTP.getCalendarBySearch(AnimeSeason(selectedDate).toSeasonStartAndEnd());}}\ No newline at end of filediff --git a/lib/pages/video/video_controller.dart b/lib/pages/video/video_controller.dartindex 4b129293..0a0d2cfa 100644--- a/lib/pages/video/video_controller.dart+++ b/lib/pages/video/video_controller.dart@@ -53,7 +53,7 @@ abstract class _VideoPageController with Store {final PluginsController pluginsController = Modular.get<PluginsController>();final HistoryController historyController = Modular.get<HistoryController>();- changeEpisode(int episode, {int currentRoad = 0, int offset = 0}) async {+ Future<void> changeEpisode(int episode, {int currentRoad = 0, int offset = 0}) async {showDebugLog = false;loading = true;currentEpisode = episode;diff --git a/lib/pages/webdav_editor/webdav_setting.dart b/lib/pages/webdav_editor/webdav_setting.dartindex 06cf6934..0d327307 100644--- a/lib/pages/webdav_editor/webdav_setting.dart+++ b/lib/pages/webdav_editor/webdav_setting.dart@@ -24,7 +24,7 @@ class _PlayerSettingsPageState extends State<WebDavSettingsPage> {void onBackPressed(BuildContext context) {}- checkWebDav() async {+ Future<void> checkWebDav() async {var webDavURL =await setting.get(SettingBoxKey.webDavURL, defaultValue: '');if (webDavURL == '') {@@ -46,7 +46,7 @@ class _PlayerSettingsPageState extends State<WebDavSettingsPage> {}}- updateWebdav() async {+ Future<void> updateWebdav() async {var webDavEnable =await setting.get(SettingBoxKey.webDavEnable, defaultValue: false);if (webDavEnable) {@@ -63,7 +63,7 @@ class _PlayerSettingsPageState extends State<WebDavSettingsPage> {}}- downloadWebdav() async {+ Future<void> downloadWebdav() async {var webDavEnable =await setting.get(SettingBoxKey.webDavEnable, defaultValue: false);if (webDavEnable) {diff --git a/lib/pages/webview/webview_controller.dart b/lib/pages/webview/webview_controller.dartindex 644a3679..1b442b78 100644--- a/lib/pages/webview/webview_controller.dart+++ b/lib/pages/webview/webview_controller.dart@@ -23,16 +23,16 @@ abstract class WebviewItemController<T> {/// Webview initialization method/// This method should eventually call the changeEpisode method of videoController- init();+ Future<void> init();/// Webview load URL method- loadUrl(String url, {int offset = 0});+ Future<void> loadUrl(String url, {int offset = 0});/// Webview unload page method- unloadPage();+ Future<void> unloadPage();/// Webview dispose method- dispose();+ void dispose();}class WebviewItemControllerFactory {diff --git a/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dart b/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dartindex b0622c2e..d0b8ade1 100644--- a/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dart+++ b/lib/pages/webview/webview_controller_impel/webview_apple_controller_impel.dart@@ -20,7 +20,7 @@ class WebviewAppleItemControllerImpelTimer? videoParserTimer;@override- init() async {+ Future<void> init() async {webviewController ??= WebViewController();videoPageController.changeEpisode(videoPageController.currentEpisode,currentRoad: videoPageController.currentRoad,@@ -28,7 +28,7 @@ class WebviewAppleItemControllerImpel}@override- loadUrl(String url, {int offset = 0}) async {+ Future<void> loadUrl(String url, {int offset = 0}) async {ifrmaeParserTimer?.cancel();videoParserTimer?.cancel();await unloadPage();@@ -151,7 +151,7 @@ class WebviewAppleItemControllerImpel}@override- unloadPage() async {+ Future<void> unloadPage() async {await webviewController!.removeJavaScriptChannel('JSBridgeDebug').catchError((_) {});@@ -168,11 +168,11 @@ class WebviewAppleItemControllerImpel}@override- dispose() {+ void dispose() {unloadPage();}- parseIframeUrl() async {+ Future<void> parseIframeUrl() async {await webviewController!.runJavaScript('''var iframes = document.getElementsByTagName('iframe');JSBridgeDebug.postMessage('The number of iframe tags is' + iframes.length);@@ -188,12 +188,12 @@ class WebviewAppleItemControllerImpel''');}- redirctWithReferer(String src) async {+ Future<void> redirctWithReferer(String src) async {await webviewController!.runJavaScript('window.location.href = "$src";');}// 非blob资源- parseVideoSource() async {+ Future<void> parseVideoSource() async {await webviewController!.runJavaScript('''var videos = document.querySelectorAll('video');VideoBridgeDebug.postMessage('The number of video tags is' + videos.length);@@ -222,7 +222,7 @@ class WebviewAppleItemControllerImpel}// blob资源- addBlobParser() async {+ Future<void> addBlobParser() async {await webviewController!.runJavaScript('''const _r_text = window.Response.prototype.text;window.Response.prototype.text = function () {@@ -280,7 +280,7 @@ class WebviewAppleItemControllerImpel''');}- addInviewIframeBridge() async {+ Future<void> addInviewIframeBridge() async {await webviewController!.runJavaScript('''window.addEventListener("message", function(event) {if (event.data) {@@ -293,13 +293,13 @@ class WebviewAppleItemControllerImpel}// 设定UA- setDesktopUserAgent() async {+ Future<void> setDesktopUserAgent() async {String desktopUserAgent = Utils.getRandomUA();await webviewController!.setUserAgent(desktopUserAgent);}// 全屏监听- addFullscreenListener() async {+ Future<void> addFullscreenListener() async {await webviewController!.runJavaScript('''document.addEventListener('fullscreenchange', () => {if (document.fullscreenElement) {diff --git a/lib/pages/webview/webview_controller_impel/webview_controller_impel.dart b/lib/pages/webview/webview_controller_impel/webview_controller_impel.dartindex 55583b01..df10f2e0 100644--- a/lib/pages/webview/webview_controller_impel/webview_controller_impel.dart+++ b/lib/pages/webview/webview_controller_impel/webview_controller_impel.dart@@ -15,7 +15,7 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewControllerTimer? videoParserTimer;@override- init() async {+ Future<void> init() async {webviewController ??= WebViewController();videoPageController.changeEpisode(videoPageController.currentEpisode,currentRoad: videoPageController.currentRoad,@@ -23,7 +23,7 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewController}@override- loadUrl(String url, {int offset = 0}) async {+ Future<void> loadUrl(String url, {int offset = 0}) async {ifrmaeParserTimer?.cancel();videoParserTimer?.cancel();await unloadPage();@@ -146,7 +146,7 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewController}@override- unloadPage() async {+ Future<void> unloadPage() async {await webviewController!.removeJavaScriptChannel('JSBridgeDebug').catchError((_) {});@@ -163,11 +163,11 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewController}@override- dispose() {+ void dispose() {unloadPage();}- parseIframeUrl() async {+ Future<void> parseIframeUrl() async {await webviewController!.runJavaScript('''var iframes = document.getElementsByTagName('iframe');JSBridgeDebug.postMessage('The number of iframe tags is' + iframes.length);@@ -183,12 +183,12 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewController''');}- redirctWithReferer(String src) async {+ Future<void> redirctWithReferer(String src) async {await webviewController!.runJavaScript('window.location.href = "$src";');}// 非blob资源- parseVideoSource() async {+ Future<void> parseVideoSource() async {await webviewController!.runJavaScript('''var videos = document.querySelectorAll('video');VideoBridgeDebug.postMessage('The number of video tags is' + videos.length);@@ -217,7 +217,7 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewController}// blob资源- addBlobParser() async {+ Future<void> addBlobParser() async {await webviewController!.runJavaScript('''const _r_text = window.Response.prototype.text;window.Response.prototype.text = function () {@@ -275,7 +275,7 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewController''');}- addInviewIframeBridge() async {+ Future<void> addInviewIframeBridge() async {await webviewController!.runJavaScript('''window.addEventListener("message", function(event) {if (event.data) {@@ -288,13 +288,13 @@ class WebviewItemControllerImpel extends WebviewItemController<WebViewController}// 设定UA- setDesktopUserAgent() async {+ Future<void> setDesktopUserAgent() async {String desktopUserAgent = Utils.getRandomUA();await webviewController!.setUserAgent(desktopUserAgent);}// 全屏监听- addFullscreenListener() async {+ Future<void> addFullscreenListener() async {await webviewController!.runJavaScript('''document.addEventListener('fullscreenchange', () => {if (document.fullscreenElement) {diff --git a/lib/pages/webview/webview_controller_impel/webview_linux_controller_impel.dart b/lib/pages/webview/webview_controller_impel/webview_linux_controller_impel.dartindex 23decd8b..690cc7a2 100644--- a/lib/pages/webview/webview_controller_impel/webview_linux_controller_impel.dart+++ b/lib/pages/webview/webview_controller_impel/webview_linux_controller_impel.dart@@ -9,7 +9,7 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {Timer? videoParserTimer;@override- init() async {+ Future<void> init() async {webviewController ??= await WebviewWindow.create(configuration: const CreateConfiguration(),);@@ -24,7 +24,7 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {}@override- loadUrl(String url, {int offset = 0}) async {+ Future<void> loadUrl(String url, {int offset = 0}) async {ifrmaeParserTimer?.cancel();videoParserTimer?.cancel();await unloadPage();@@ -67,16 +67,16 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {}@override- unloadPage() async {+ Future<void> unloadPage() async {await redirect2Blank();}@override- dispose() {+ void dispose() {webviewController!.close();}- initJSBridge() async {+ Future<void> initJSBridge() async {webviewController!.addOnWebMessageReceivedCallback((message) async {if (message.contains('iframeMessage:')) {String messageItem =@@ -134,7 +134,7 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {});}- parseIframeUrl() async {+ Future<void> parseIframeUrl() async {await webviewController!.evaluateJavaScript('''var iframes = document.getElementsByTagName('iframe');window.webkit.messageHandlers.msgToNative.postMessage('iframeMessage:' + 'The number of iframe tags is' + iframes.length);@@ -152,7 +152,7 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {}// 非blob资源- parseVideoSource() async {+ Future<void> parseVideoSource() async {await webviewController!.evaluateJavaScript('''var videos = document.querySelectorAll('video');window.webkit.messageHandlers.msgToNative.postMessage('videoMessage:' + 'The number of video tags is' + videos.length);@@ -181,7 +181,7 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {}// blob资源/iframe桥- initBlobParserAndiframeBridge() async {+ Future<void> initBlobParserAndiframeBridge() async {webviewController!.setOnUrlRequestCallback((url) {debugPrint('Current URL: $url');return true;@@ -254,7 +254,7 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {// webview_windows本身无此方法,loadurl方法相当于打开新标签页,会造成内存泄漏// 而直接销毁 webview 控制器会导致更换选集时需要重新初始化,webview 重新初始化开销较大// 故使用此方法- redirect2Blank() async {+ Future<void> redirect2Blank() async {await webviewController!.evaluateJavaScript('''window.location.href = 'about:blank';''');diff --git a/lib/pages/webview/webview_controller_impel/webview_windows_controller_impel.dart b/lib/pages/webview/webview_controller_impel/webview_windows_controller_impel.dartindex 667c17cc..32651d48 100644--- a/lib/pages/webview/webview_controller_impel/webview_windows_controller_impel.dart+++ b/lib/pages/webview/webview_controller_impel/webview_windows_controller_impel.dart@@ -9,7 +9,7 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewConTimer? videoParserTimer;@override- init() async {+ Future<void> init() async {webviewController ??= WebviewController();await webviewController!.initialize();await webviewController!.setPopupWindowPolicy(WebviewPopupWindowPolicy.deny);@@ -25,7 +25,7 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewCon}@override- loadUrl(String url, {int offset = 0}) async {+ Future<void> loadUrl(String url, {int offset = 0}) async {ifrmaeParserTimer?.cancel();videoParserTimer?.cancel();await unloadPage();@@ -68,17 +68,17 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewCon}@override- unloadPage() async {+ Future<void> unloadPage() async {await redirect2Blank();await webviewController!.clearCache();}@override- dispose() {+ void dispose() {webviewController!.dispose();}- initJSBridge() async {+ Future<void> initJSBridge() async {webviewController!.webMessage.listen((event) async {if (event.toString().contains('iframeMessage:')) {String messageItem =@@ -136,7 +136,7 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewCon});}- parseIframeUrl() async {+ Future<void> parseIframeUrl() async {await webviewController!.executeScript('''var iframes = document.getElementsByTagName('iframe');window.chrome.webview.postMessage('iframeMessage:' + 'The number of iframe tags is' + iframes.length);@@ -154,7 +154,7 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewCon}// 非blob资源- parseVideoSource() async {+ Future<void> parseVideoSource() async {await webviewController!.executeScript('''var videos = document.querySelectorAll('video');window.chrome.webview.postMessage('videoMessage:' + 'The number of video tags is' + videos.length);@@ -182,7 +182,7 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewCon}// blob资源- initBlobParser() async {+ Future<void> initBlobParser() async {await webviewController!.addScriptToExecuteOnDocumentCreated('''const _r_text = window.Response.prototype.text;window.Response.prototype.text = function () {@@ -239,7 +239,7 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewCon''');}- initInviewIframeBridge() async {+ Future<void> initInviewIframeBridge() async {await webviewController!.addScriptToExecuteOnDocumentCreated('''window.addEventListener("message", function(event) {if (event.data) {@@ -254,7 +254,7 @@ class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewCon// webview_windows本身无此方法,loadurl方法相当于打开新标签页,会造成内存泄漏// 而直接销毁 webview 控制器会导致更换选集时需要重新初始化,webview 重新初始化开销较大// 故使用此方法- redirect2Blank() async {+ Future<void> redirect2Blank() async {await webviewController!.executeScript('''window.location.href = 'about:blank';''');diff --git a/lib/plugins/plugins.dart b/lib/plugins/plugins.dartindex c9fbcf2a..0ea29e23 100644--- a/lib/plugins/plugins.dart+++ b/lib/plugins/plugins.dart@@ -115,7 +115,7 @@ class Plugin {return data;}- queryBangumi(String keyword, {bool shouldRethrow = false}) async {+ Future<PluginSearchResponse> queryBangumi(String keyword, {bool shouldRethrow = false}) async {String queryURL = searchURL.replaceAll('@keyword', keyword);dynamic resp;List<SearchItem> searchItems = [];@@ -162,7 +162,7 @@ class Plugin {return pluginSearchResponse;}- querychapterRoads(String url) async {+ Future<List<Road>> querychapterRoads(String url) async {List<Road> roadList = [];// 预处理if (!url.contains('https')) {diff --git a/lib/request/bangumi.dart b/lib/request/bangumi.dartindex 33f32f89..2a0325bd 100644--- a/lib/request/bangumi.dart+++ b/lib/request/bangumi.dart@@ -12,7 +12,7 @@ import 'package:kazumi/modules/bangumi/episode_item.dart';class BangumiHTTP {// why the api havn't been replaced by getCalendarBySearch?// Because getCalendarBySearch is not stable, it will miss some bangumi items.- static Future getCalendar() async {+ static Future<List<List<BangumiItem>>> getCalendar() async {List<List<BangumiItem>> bangumiCalendar = [];try {var res = await Request().get(Api.bangumiCalendar,@@ -43,7 +43,7 @@ class BangumiHTTP {// Get clander by search API, we need a list of strings (the start of the season and the end of the season) eg: ["2024-07-01", "2024-10-01"]// because the air date is the launch date of the anime, it is usually a few days before the start of the season// So we usually use the start of the season month -1 and the end of the season month -1- static Future getCalendarBySearch(List<String> dateRange) async {+ static Future<List<List<BangumiItem>>> getCalendarBySearch(List<String> dateRange) async {List<BangumiItem> bangumiList = [];List<List<BangumiItem>> bangumiCalendar = [];var params = <String, dynamic>{@@ -89,7 +89,7 @@ class BangumiHTTP {return bangumiCalendar;}- static Future getBangumiList({int rank = 2, String tag = ''}) async {+ static Future<List<BangumiItem>> getBangumiList({int rank = 2, String tag = ''}) async {List<BangumiItem> bangumiList = [];late Map<String, dynamic> params;if (tag == '') {@@ -134,7 +134,7 @@ class BangumiHTTP {return bangumiList;}- static Future bangumiSearch(String keyword) async {+ static Future<List<BangumiItem>> bangumiSearch(String keyword) async {List<BangumiItem> bangumiList = [];var params = <String, dynamic>{@@ -174,7 +174,7 @@ class BangumiHTTP {return bangumiList;}- static getBangumiSummaryByID(int id) async {+ static Future<String> getBangumiSummaryByID(int id) async {try {final res = await Request().get(Api.bangumiInfoByID + id.toString(),options: Options(headers: bangumiHTTPHeader));diff --git a/lib/request/damaku.dart b/lib/request/damaku.dartindex 8bb975b9..f59ce0f3 100644--- a/lib/request/damaku.dart+++ b/lib/request/damaku.dart@@ -12,7 +12,7 @@ import 'package:kazumi/modules/danmaku/danmaku_episode_response.dart';class DanmakuRequest {//获取弹弹Play集合,需要进一步处理- static getBangumiID(String title) async {+ static Future<int> getBangumiID(String title) async {DanmakuSearchResponse danmakuSearchResponse = await getDanmakuSearchResponse(title);// 保留此判断以防止错误匹配@@ -27,7 +27,7 @@ class DanmakuRequest {}//从BangumiID获取分集ID- static getDanDanEpisodesByBangumiID(int bangumiID) async {+ static Future<DanmakuEpisodeResponse> getDanDanEpisodesByBangumiID(int bangumiID) async {var httpHeaders = {'user-agent':Utils.getRandomUA(),@@ -57,7 +57,7 @@ class DanmakuRequest {return danmakuSearchResponse;}- static getDanDanmaku(int bangumiID, int episode) async {+ static Future<List<Danmaku>> getDanDanmaku(int bangumiID, int episode) async {List<Danmaku> danmakus = [];if (bangumiID == 100000) {return danmakus;@@ -88,7 +88,7 @@ class DanmakuRequest {return danmakus;}- static getDanDanmakuByEpisodeID(int episodeID) async {+ static Future<List<Danmaku>> getDanDanmakuByEpisodeID(int episodeID) async {List<Danmaku> danmakus = [];var httpHeaders = {'user-agent':diff --git a/lib/request/plugin.dart b/lib/request/plugin.dartindex 891dd756..53c43102 100644--- a/lib/request/plugin.dart+++ b/lib/request/plugin.dart@@ -6,7 +6,7 @@ import 'package:kazumi/plugins/plugins.dart';import 'package:kazumi/modules/plugin/plugin_http_module.dart';class PluginHTTP {- static Future getPluginList() async {+ static Future<List<PluginHTTPItem>> getPluginList() async {List<PluginHTTPItem> pluginHTTPItemList = [];try {var res = await Request().get('${Api.pluginShop}index.json');diff --git a/lib/request/request.dart b/lib/request/request.dartindex bda43f0a..91a45f83 100644--- a/lib/request/request.dart+++ b/lib/request/request.dart@@ -17,18 +17,18 @@ class Request {factory Request() => _instance;// 初始化 (一般只在应用启动时调用)- static setCookie() {+ static Future<void> setCookie() async {setOptionsHeaders();}// 设置请求头- static setOptionsHeaders() {+ static void setOptionsHeaders() {dio.options.headers['referer'] = '';dio.options.headers['user-agent'] = Utils.getRandomUA();}// 设置代理- static setProxy() {+ static void setProxy() {// var systemProxyHost =// localCache.get(LocalCacheKey.systemProxyHost, defaultValue: '');// var systemProxyPort =@@ -50,7 +50,7 @@ class Request {}// 禁用代理- static disableProxy() {+ static void disableProxy() {dio.httpClientAdapter = IOHttpClientAdapter(createHttpClient: () {final HttpClient client = HttpClient();@@ -100,7 +100,7 @@ class Request {};}- get(url, {data, options, cancelToken, extra, bool shouldRethrow = false}) async {+ Future<Response> get(url, {data, options, cancelToken, extra, bool shouldRethrow = false}) async {Response response;final Options options = Options();ResponseType resType = ResponseType.json;@@ -135,7 +135,7 @@ class Request {}}- post(url, {data, queryParameters, options, cancelToken, extra, bool shouldRethrow = false}) async {+ Future<Response> post(url, {data, queryParameters, options, cancelToken, extra, bool shouldRethrow = false}) async {// print('post-data: $data');Response response;try {diff --git a/lib/utils/utils.dart b/lib/utils/utils.dartindex 3864b81c..9f197872 100644--- a/lib/utils/utils.dart+++ b/lib/utils/utils.dart@@ -300,9 +300,6 @@ class Utils {return false;}- // 下载适用于当前系统的安装包- static Future matchVersion(data) async {}-// 时间戳转时间static tampToSeektime(number) {int hours = number ~/ 60;diff --git a/lib/utils/webdav.dart b/lib/utils/webdav.dartindex d3732eb0..446c1619 100644--- a/lib/utils/webdav.dart+++ b/lib/utils/webdav.dart@@ -17,7 +17,7 @@ class WebDav {static final WebDav _instance = WebDav._internal();factory WebDav() => _instance;- Future init() async {+ Future<void> init() async {var directory = await getApplicationSupportDirectory();webDavLocalTempDirectory = Directory('${directory.path}/webdavTemp');Box setting = GStorage.setting;@@ -42,7 +42,7 @@ class WebDav {}}- Future update(String boxName) async {+ Future<void> update(String boxName) async {var directory = await getApplicationSupportDirectory();try {await client.remove('/kazumiSync/$boxName.tmp.cache');@@ -60,15 +60,15 @@ class WebDav {'/kazumiSync/$boxName.tmp.cache', '/kazumiSync/$boxName.tmp', true);}- Future updateHistory() async {+ Future<void> updateHistory() async {await update('histories');}- Future updateFavorite() async {+ Future<void> updateFavorite() async {await update('favorites');}- Future downloadHistory() async {+ Future<void> downloadHistory() async {String fileName = 'histories.tmp';if (!await webDavLocalTempDirectory.exists()) {await webDavLocalTempDirectory.create(recursive: true);@@ -84,7 +84,7 @@ class WebDav {await GStorage.patchHistory(existingFile.path);}- Future downloadFavorite() async {+ Future<void> downloadFavorite() async {String fileName = 'favorites.tmp';if (!await webDavLocalTempDirectory.exists()) {await webDavLocalTempDirectory.create(recursive: true);@@ -100,7 +100,7 @@ class WebDav {await GStorage.patchFavorites(existingFile.path);}- Future ping() async {+ Future<void> ping() async {await client.ping();}}