deviceType method
Implementation
DeviceType deviceType() {
DeviceType deviceType;
switch (Platform.operatingSystem) {
case 'android':
case 'ios':
deviceType = DeviceType.mobile;
if ((orientation == Orientation.portrait && screenWidth < 600) ||
(orientation == Orientation.landscape && screenHeight < 600)) {
deviceType = DeviceType.mobile;
} else {
deviceType = DeviceType.tablet;
}
break;
case 'linux':
deviceType = DeviceType.linux;
break;
case 'macos':
deviceType = DeviceType.mac;
break;
case 'windows':
deviceType = DeviceType.windows;
break;
case 'fuchsia':
deviceType = DeviceType.fuchsia;
break;
default:
deviceType = DeviceType.web;
}
return deviceType;
}