EnvironmentDetector class

Detects the current RuntimeEnvironment by inspecting environment variables and stdout capabilities.

Detection order (first match wins):

  1. GCP — K_SERVICE (Cloud Run), GAE_SERVICE (App Engine), FUNCTION_NAME (Cloud Functions gen 1), or FUNCTION_TARGET (gen 2).
  2. AWS — AWS_LAMBDA_FUNCTION_NAME (Lambda) or ECS_CONTAINER_METADATA_URI[_V4] (ECS / Fargate).
  3. Azure — WEBSITE_SITE_NAME (App Service + Functions on *.azurewebsites.net), FUNCTIONS_WORKER_RUNTIME (any Functions host), or CONTAINER_APP_NAME (Container Apps).
  4. CI — any of the well-known CI env vars are set.
  5. Human — anything else; capabilities derived from stdout introspection plus IDE-launch hints (macOS __CFBundleIdentifier matches a JetBrains, Android Studio, or VS Code bundle).

Constructors

EnvironmentDetector()
const

Properties

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

Methods

detect({Map<String, String>? envOverride, TerminalCapabilities? capabilitiesOverride}) RuntimeEnvironment
Detects the current environment.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

detectCapabilities({Map<String, String>? envOverride}) TerminalCapabilities
Builds TerminalCapabilities for the current process by inspecting stdout + environment variables.