feat: support flutter web

This commit is contained in:
levi authored and monkeyWie committed 2022-10-27 13:58:43 +08:00
1 parent c4a30dc4c2
commit 4d4d3b446a
39 files changed
+450 -299

No files matched your search

+20
View File
@@ -1,5 +1,7 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
class Util {
static String fmtByte(int byte) {
if (byte < 1024) {
@@ -21,11 +23,29 @@ class Util {
return (dir == "" ? "" : "$dir/") + buildPath(path, name);
}
static isWeb() {
return kIsWeb;
}
static isAndroid() {
return !kIsWeb && Platform.isAndroid;
}
static isMacos() {
return !kIsWeb && Platform.isMacOS;
}
static isDesktop() {
if (kIsWeb) {
return false;
}
return Platform.isWindows || Platform.isLinux || Platform.isMacOS;
}
static isUnix() {
if (kIsWeb) {
return false;
}
return !Platform.isWindows;
}
}