Skip to content
pubscout

stdlibc

0.1.4, released 3 years ago by canonical.com

FFI bindings to the GNU C Library on Linux and the BSD C Library on macOS

$ flutter pub add stdlibc
Source repository

What it does

Provides Foreign Function Interface (FFI) bindings for standard C library functions on Linux and macOS. It allows developers to call system calls and standard C functions directly from Dart.

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

Use it when

  • You need to access low-level operating system functions via C standard library bindings on Linux or macOS.
  • You are building system-level command line tools or utilities in Dart for Unix-like environments.

Skip it when

  • You are targeting platforms other than Linux or macOS.
  • You prefer pure Dart abstractions over direct C function bindings.

Strengths

  • Provides direct access to low-level C library functions.
  • Supports common system operations like process management, file operations, and system information.

Weaknesses

  • Limited platform support (only Linux and macOS).
  • Requires dealing with low-level FFI and C paradigms.

Setup

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

Not documented

import 'package:stdlibc/stdlibc.dart';

void main() {
  if (geteuid() == 0) {
    print('WARNING: running as root');
  }

  final utsname = uname();
  print('System: ${utsname.sysname} (${utsname.nodename})');
}

Alternatives

Packages that do the same job and could replace stdlibc.

Works with

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