mobile_skt/lib/util/device.util.dart

20 lines
431 B
Dart
Raw Normal View History

2024-04-07 17:32:46 +08:00
import 'dart:io';
import 'package:package_info/package_info.dart';
class DeviceUtil {
/// 获取当前版本
static Future<String> getAppVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return packageInfo.version;
}
/// 获取平台信息
static Future<String> getPlatForm() async {
if (Platform.isAndroid) {
return 'android';
} else {
return 'ios';
}
}
}