kirz_cpu_info 0.1.0
kirz_cpu_info: ^0.1.0 copied to clipboard
A Flutter plugin to get CPU usage information. iOS only.
kirz_cpu_info #
A Flutter plugin to get system CPU usage percentage on iOS devices.
Platform Support #
- ✅ iOS
- ❌ Android (throws an error)
Features #
- Get total CPU usage percentage (0-100) for the whole system
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
kirz_cpu_info: ^0.1.0
Usage #
import 'package:kirz_cpu_info/kirz_cpu_info.dart';
try {
final usage = await KirzCpuInfo.getProcessorUsage();
print('CPU usage: ${usage.toStringAsFixed(1)}%');
} catch (e) {
print('Error: $e'); // Will throw on Android
}
Platform-Specific Notes #
iOS #
Uses HOST_CPU_LOAD_INFO tick deltas (user + system + nice) to compute a usage percentage.
Android #
Throws a PlatformException with code UNSUPPORTED_PLATFORM when called.
License #
MIT License