update method

Future<void> update()

Queries the native platform for current CPU usage.

Implementation

Future<void> update() async {
  try {
    final result = await _channel.invokeMethod<double>('getCpuUsage');
    _cpuUsagePercent = (result ?? 0).clamp(0, 100);
  } on MissingPluginException {
    _cpuUsagePercent = 0;
  } on PlatformException {
    _cpuUsagePercent = 0;
  }
}