GlobalEnvironment constructor

GlobalEnvironment()

A concrete implementation of AbstractEnvironment that represents the default runtime environment for most applications.

It supports:

  • System environment variables via Platform.environment
  • Active and default profile management
  • Placeholder resolution and conversion via the parent class

This class automatically registers a SystemEnvironmentPropertySource under the name 'systemEnvironment'. It also maintains a set of active and default profiles, which can be queried using acceptsProfiles and matchesProfiles.

Example usage:

final env = StandardEnvironment();

env.setActiveProfiles(['dev']);
env.setDefaultProfiles(['default']);

print(env.activeProfiles); // [dev]
print(env.getProperty('PATH')); // system environment variable

if (env.acceptsProfiles(Profiles.of(['dev']))) {
  print('Running in dev mode');
}

The default profile is always 'default' unless overridden explicitly.

Implementation

GlobalEnvironment();