EnvironmentDetector class
Detects the current RuntimeEnvironment by inspecting environment variables and stdout capabilities.
Detection order (first match wins):
- GCP —
K_SERVICE(Cloud Run),GAE_SERVICE(App Engine),FUNCTION_NAME(Cloud Functions gen 1), orFUNCTION_TARGET(gen 2). - AWS —
AWS_LAMBDA_FUNCTION_NAME(Lambda) orECS_CONTAINER_METADATA_URI[_V4](ECS / Fargate). - Azure —
WEBSITE_SITE_NAME(App Service + Functions on*.azurewebsites.net),FUNCTIONS_WORKER_RUNTIME(any Functions host), orCONTAINER_APP_NAME(Container Apps). - CI — any of the well-known CI env vars are set.
- Human — anything else; capabilities derived from stdout
introspection plus IDE-launch hints (macOS
__CFBundleIdentifiermatches 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.