getSystemVersion static method

Future<String> getSystemVersion()

Implementation

static Future<String> getSystemVersion() async {
  try {
    if (Platform.isAndroid) {
      DeviceInfoPlugin.AndroidDeviceInfo androidInfo =
          await deviceInfoPlugin.androidInfo;
      return androidInfo.version.release;
    }
    if (Platform.isIOS) {
      DeviceInfoPlugin.IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
      return iosInfo.systemVersion;
    }
    return '';
  } catch (e, stackTrace) {
    StormyLog.e(
      'AppUtils.getSystemVersion: 获取系统版本号失败',
      stackTrace: stackTrace,
      extra: {'error': e.toString()},
    );
    return '';
  }
}