20 lines
431 B
Dart
20 lines
431 B
Dart
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';
|
|
}
|
|
}
|
|
}
|