PlatformQueryData.detect constructor
PlatformQueryData.detect()
Creates a new PlatformQueryData depending on platform.
MAX_PHONE_SHORTEST_SIDE is used to detect phone or tablet devices
Note:
- DeviceType.watch and DeviceType.tv are not supported.
Implementation
factory PlatformQueryData.detect() {
var platform = PlatformType.unknown;
if (kIsWeb) {
platform = PlatformType.web;
} else if (Platform.isIOS) {
platform = PlatformType.ios;
} else if (Platform.isAndroid) {
platform = PlatformType.android;
} else if (Platform.isLinux) {
platform = PlatformType.linux;
} else if (Platform.isMacOS) {
platform = PlatformType.macOS;
} else if (Platform.isWindows) {
platform = PlatformType.windows;
} else {
platform = PlatformType.unknown;
}
return PlatformQueryData(platformType: platform);
}