Wallpaper-Genie/lib/common/utils/device_info_util.dart
2024-07-12 16:04:47 +08:00

18 lines
640 B
Dart

import 'package:device_info_plus/device_info_plus.dart';
class DeviceInfoUtil {
/// 获取当前Android设备的系统版本
static Future<int> getAndroidSystemVersion() async {
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
AndroidDeviceInfo androidDeviceInfo = await deviceInfoPlugin.androidInfo;
return androidDeviceInfo.version.sdkInt;
}
/// 获取当前iOS设备的系统版本
static Future<String> getIOSSystemVersion() async {
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
IosDeviceInfo iosDeviceInfo = await deviceInfoPlugin.iosInfo;
return iosDeviceInfo.systemVersion;
}
}