getPlatformVersion method

  1. @override
Future<String?> getPlatformVersion()
override

Implementation

@override
Future<String?> getPlatformVersion() async {
  try {
    final version = await Process.run('cmd', ['/c', 'ver']);
    if (version.exitCode == 0) {
      return version.stdout.toString();
    } else {
      throw Exception('Failed to get platform version');
    }
  } catch (e) {
    if (kDebugMode) {
      print('Error getting platform version: $e');
    }
    return null;
  }
}