Skip to content
pubscout

system_resources_2

2.2.2, released 9 months ago by serverpod.dev

Access CPU and memory usage, container-aware, pure Dart on Linux, FFI on macOS

$ flutter pub add system_resources_2
Source repository

What it does

Provides APIs to read CPU load, CPU limits, memory usage and limits, and detect container environments. It uses cgroup files on Linux and native dylibs on macOS.

AI-written summary of version 2.2.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Need to monitor system resources in a Dart/Flutter app
  • Running in containers and want metrics relative to limits
  • Cross-platform (Linux/macOS) resource monitoring without native dependencies on Linux

Skip it when

  • Running on Windows or unsupported platforms
  • You need advanced profiling or GPU metrics
  • You need to run on iOS/Android

Strengths

  • Pure Dart on Linux eliminates native binaries
  • Container-aware with cgroup v1/v2 support
  • No external dependencies beyond ffi
  • Supports gVisor environments

Weaknesses

  • Not supported on Windows, iOS, Android
  • Requires macOS dylib for macOS
  • No support for other platforms like web or mobile

Setup

Kind
FFI (native library)
Effort
Low
Code generation
No
Direct dependencies
1

Add dependency, call SystemResources.init() on macOS, no special permissions needed

import 'package:system_resources_2/system_resources_2.dart';

void main() async {
  await SystemResources.init();
  print('CPU Load: ${(SystemResources.cpuLoadAvg()*100).toInt()}%');
  print('Memory Usage: ${(SystemResources.memUsage()*100).toInt()}%');
}

Alternatives

Packages that do the same job and could replace system_resources_2.

  • pool

    Manage a finite pool of resources to control concurrent operations.

  • english_words

    Utilities for working with English words, counting syllables, and generating word combinations.

  • semaphore

    Lightweight semaphore, condition variable, and lock implementation for isolates.

Works with

Packages commonly used together with system_resources_2: ones it builds on, ones built on it, and its own family.