getSystemInfo method

  1. @override
Future<SystemInfo> getSystemInfo()
override

Implementation

@override
Future<SystemInfo> getSystemInfo() async {
  try {
    final Map<dynamic, dynamic>? res = await methodChannel.invokeMethod('getSystemInfo');
    if (res == null) return const SystemInfo();
    return SystemInfo.fromMap(res.cast<String, dynamic>());
  } on PlatformException catch (e) {
    throw DeviceInspectorException(
      _mapErrorCode(e.code),
      e.message ?? 'Failed to get system info',
      cause: e,
    );
  } catch (e) {
    throw DeviceInspectorException(
      DeviceErrorCode.unknown,
      'Unexpected error getting system info: $e',
      cause: e,
    );
  }
}