SystemExtension extension

Extension on InternalSystemContext that provides access to system-level and environment-related properties similar to Java's System.getProperties() and System.getenv().

This includes metadata about the Dart runtime, host operating system, environment variables, and more.

Example

final properties = context.getProperties();
print(properties['os.name']); // e.g., 'macos'

final dartVersion = context.getProperty('dart.version');
print(dartVersion); // e.g., '3.3.0'

final env = context.getEnv();
print(env['PATH']);

final home = context.getEnvVar('HOME');
print(home);

Useful in cross-platform utilities, diagnostics, and configuration loading.

on
  • _System

Methods

getEnv() Map<String, String>

Available on _System, provided by the SystemExtension extension

Extension on InternalSystemContext that provides access to system-level and environment-related properties similar to Java's System.getProperties() and System.getenv().
getEnvVar(String name) String?

Available on _System, provided by the SystemExtension extension

Returns the environment variable value for the given name, or null if not defined.
getProperties() Map<String, String>

Available on _System, provided by the SystemExtension extension

Extension on InternalSystemContext that provides access to system-level and environment-related properties similar to Java's System.getProperties() and System.getenv().
getProperty(String name) String?

Available on _System, provided by the SystemExtension extension

Returns the system property value for the given name, or null if not found.