cloudflareEnvironmentOf function

CloudflareEnvironment? cloudflareEnvironmentOf(
  1. EngineContext context
)

Returns the Worker environment associated with context, when present.

Implementation

CloudflareEnvironment? cloudflareEnvironmentOf(EngineContext context) {
  final extension = routedNodeExtensionOf<FetchRuntimeExtension>(context);
  final environment = extension?.environment;
  if (environment is CloudflareEnvironment) return environment;
  return environment == null
      ? null
      : cloudflareEnvironmentFromJavaScript(environment);
}