# Environment class abstract

Environment Contract

Defines the core abstraction for accessing environment configuration and managing active profiles. This interface extends both:

- `PropertyResolver`: for resolving configuration properties (e.g., values defined in environment variables, property files, or injected maps).
- PackageIdentifier: for uniquely identifying the runtime context or configuration package.

# Profiles

Profiles are logical groupings of configuration settings that allow an application to adapt to different runtime contexts such as:

- `dev` (development)
- `test` (testing/CI)
- `staging` (pre-production verification)
- `prod` (production)

Profiles can be explicitly activated or fall back to defaults when none are provided. They are commonly used in conditional configuration, e.g., loading different data sources, enabling debugging, or disabling experimental features.

# Example

    void configure(Environment env) {
      if (env.matchesProfiles(['dev & !prod'])) {
        // Apply development-only settings
      }
    }

Implemented types
  - PackageIdentifier

## Constructors

Environment.new()

## Properties

hashCode → int
  The hash code for this object.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited

## Methods

acceptsProfiles(Profiles profiles) → bool
  Profile Predicate Evaluation
containsProperty(String key) → bool
  Returns whether the given property `key` is defined.
  inherited
getActiveProfiles() → List<String>
  Active Profiles
getDefaultProfiles() → List<String>
  Default Profiles
getPackageName() → String
  Represents an abstraction for identifying the package that an object, resource, or service belongs to.
  inherited
getProperty(String key, [String? defaultValue]) → String?
  Retrieves the value for the given property `key`, or `null` if not found.
  inherited
getPropertyAs<T>(String key, Class<T> targetType, [T? defaultValue]) → T?
  Retrieves and converts the value of `key` to the desired type `T`.
  inherited
getRequiredProperty(String key) → String
  Returns the property value for `key`, or throws IllegalStateException if the property is not defined.
  inherited
getRequiredPropertyAs<T>(String key, Class<T> targetType) → T
  Retrieves and converts the property `key` to type `T`, or throws IllegalStateException if missing or invalid.
  inherited
matchesProfiles(List<String> profileExpressions) → bool
  Profile Expression Matcher
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
resolvePlaceholders(String text) → String
  Resolves `#{...}` placeholders in the input `text` using available properties.
  inherited
resolveRequiredPlaceholders(String text) → String
  Resolves `#{...}` placeholders in the input `text` using available properties.
  inherited
suggestions(String key) → List<String>
  Configuration Suggestions
toString() → String
  A string representation of this object.
  inherited

## Operators

operator ==(Object other) → bool
  The equality operator.
  inherited