Closed giorgio79 closed 2 years ago
Temporary solution:
extension UniversalPlatformGetType on UniversalPlatform {
static UniversalPlatformType get type {
if (UniversalPlatform.isMacOS) {
return UniversalPlatformType.MacOS;
} else if (UniversalPlatform.isWindows) {
return UniversalPlatformType.Windows;
} else if (UniversalPlatform.isLinux) {
return UniversalPlatformType.Linux;
} else if (UniversalPlatform.isAndroid) {
return UniversalPlatformType.Android;
} else if (UniversalPlatform.isIOS) {
return UniversalPlatformType.IOS;
} else if (UniversalPlatform.isFuchsia) {
return UniversalPlatformType.Fuchsia;
}
return UniversalPlatformType.Web;
}
static String get operatingSystem {
return type.operatingSystem;
}
}
extension UniversalPlatformTypeToOperatingSystem on UniversalPlatformType {
String get operatingSystem {
switch (this) {
case UniversalPlatformType.MacOS:
return "macos";
case UniversalPlatformType.Windows:
return "windows";
case UniversalPlatformType.Linux:
return "linux";
case UniversalPlatformType.Android:
return "android";
case UniversalPlatformType.IOS:
return "ios";
case UniversalPlatformType.Fuchsia:
return "fuchsia";
case UniversalPlatformType.Web:
default:
return "web";
}
}
}
// Usage:
print(
UniversalPlatformGetType.operatingSystem
);
Hello,
Love the package and the fact that it has lots of booleans. Could we get a detected operatingSystem output as well similar to dart.io?