dart: fix

This commit is contained in:
2025-08-15 22:52:13 +08:00
parent 44bf771f4c
commit 99104527d4
30 changed files with 57 additions and 56 deletions

View File

@@ -21,7 +21,7 @@ class ConstConf {
class AppConf {
static List<String>? _networkGameChannels;
static setNetworkChannels(List<String>? channels) {
static void setNetworkChannels(List<String>? channels) {
_networkGameChannels = channels;
}

View File

@@ -6,7 +6,7 @@ import 'package:starcitizen_doctor/common/utils/log.dart';
class SystemHelper {
static String powershellPath = "powershell.exe";
static initPowershellPath() async {
static Future<void> initPowershellPath() async {
try {
var result = await Process.run(powershellPath, ["echo", "pong"]);
if (!result.stdout.toString().startsWith("pong") && powershellPath == "powershell.exe") {
@@ -58,7 +58,7 @@ class SystemHelper {
return result.stderr;
}
static doRemoveNvmePath() async {
static Future<bool> doRemoveNvmePath() async {
try {
var result = await Process.run(powershellPath, [
"Clear-ItemProperty",
@@ -110,7 +110,7 @@ class SystemHelper {
return "";
}
static killRSILauncher() async {
static Future<void> killRSILauncher() async {
var psr = await Process.run(powershellPath, ["ps", "\"RSI Launcher\"", "|select -expand id"]);
if (psr.stderr == "") {
for (var value in (psr.stdout ?? "").toString().split("\n")) {
@@ -139,7 +139,7 @@ class SystemHelper {
}
}
static checkAndLaunchRSILauncher(String path) async {
static Future<void> checkAndLaunchRSILauncher(String path) async {
// check running and kill
await killRSILauncher();
// launch
@@ -254,7 +254,7 @@ foreach ($adapter in $adapterMemory) {
return int.parse(binaryString, radix: 2).toRadixString(16).padLeft(hexDigits, '0').toUpperCase();
}
static Future openDir(path, {bool isFile = false}) async {
static Future openDir(dynamic path, {bool isFile = false}) async {
dPrint("SystemHelper.openDir path === $path");
if (Platform.isWindows) {
await Process.run(

View File

@@ -7,7 +7,7 @@ import 'package:starcitizen_doctor/common/rust/api/http_api.dart';
import 'package:starcitizen_doctor/common/rust/http_package.dart';
class RSHttp {
static init() async {
static Future<void> init() async {
await rust_http.setDefaultHeader(headers: {
"User-Agent":
"SCToolBox/${ConstConf.appVersion} (${ConstConf.appVersionCode})${ConstConf.isMSE ? "" : " DEV"} RSHttp"

View File

@@ -8,7 +8,7 @@ export 'package:starcitizen_doctor/generated/l10n.dart';
var _logLock = Lock();
File? _logFile;
void dPrint(src) async {
void dPrint(dynamic src) async {
if (kDebugMode) {
print(src);
return;

View File

@@ -50,7 +50,7 @@ class MultiWindowManager {
// sendAppStateBroadcast(appGlobalState);
}
static sendAppStateBroadcast(AppGlobalState appGlobalState) {
static void sendAppStateBroadcast(AppGlobalState appGlobalState) {
DesktopMultiWindow.invokeMethod(
0,
'app_state_broadcast',