getOperatingSystem method

Future<String> getOperatingSystem()

Retrieves the operating system of the device.

Returns the name of the operating system (e.g., 'android', 'ios'). If an error occurs, it returns 'Unknown'.

Implementation

Future<String> getOperatingSystem() async {
  try {
    return Platform.operatingSystem;
  } catch (e) {
    debugPrint('Error getting operating system: $e');
    return 'Unknown';
  }
}