getProperties method

Map<String, String> getProperties()

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.

Returns a map of all available system-related properties.

This is similar to Java's System.getProperties() and may include:

  • dart.version
  • dart.executable
  • os.name
  • os.version
  • os.arch
  • locale
  • cpu.cores

You can retrieve a specific property using getProperty.

Implementation

Map<String, String> getProperties() => _properties;