fix parse dyn

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-31 18:14:48 +08:00
parent a53be6814c
commit 0a5965a423
9 changed files with 92 additions and 377 deletions

View File

@@ -25,6 +25,13 @@ abstract class Utils {
static final bool isDesktop =
Platform.isWindows || Platform.isMacOS || Platform.isLinux;
static int? safeToInt(dynamic value) => switch (value) {
int e => e,
String e => int.tryParse(e),
num e => e.toInt(),
_ => null,
};
static Future<bool> get isWiFi async {
try {
return Utils.isMobile &&