getSystemStatus method

  1. @override
Future<SystemStatusModel?> getSystemStatus({
  1. Set<SystemStatusTypeEnum>? systemStatusTypes,
})
override

Fetches the system status based on the provided types.

This method retrieves various system status information based on the specified systemStatusTypes. It returns a SystemStatusModel object containing CPU usage, disk space, memory statistics, and battery status information.

Throws an UnimplementedError indicating that the method has not been implemented yet.

Implementation

@override
Future<SystemStatusModel?> getSystemStatus({Set<SystemStatusTypeEnum>? systemStatusTypes}) async {
  try {
    final systemStatusModel = await methodChannel.invokeMethod<String?>('getSystemStatus', {'types': systemStatusTypes?.map((e) => e.name).toList()}).then((stringValue) {
      if (stringValue != null) {
        return SystemStatusModel.fromJson(json.decode(stringValue) as Map<String, dynamic>);
      }
      return null;
    });

    if (systemStatusModel != null) {
      return systemStatusModel;
    }
    return null;
  } catch (e) {
    debugPrint(e.toString());
  }
  return null;
}