runZoned<R> 静态方法

R runZoned<R>(
  1. R body(
      ),
    1. {HttpClient createHttpClient(
      1. SecurityContext?
      )?,
    2. String findProxyFromEnvironment(
      1. Uri uri,
      2. Map<String, String>? environment
      )?}
    )

    在提供的覆盖支持下,在全新的 Zone 中运行 body

    实现方式

    static R runZoned<R>(R Function() body,
        {HttpClient Function(SecurityContext?)? createHttpClient,
        String Function(Uri uri, Map<String, String>? environment)?
            findProxyFromEnvironment}) {
      HttpOverrides overrides =
          _HttpOverridesScope(createHttpClient, findProxyFromEnvironment);
      return dart_async.runZoned<R>(body,
          zoneValues: {_httpOverridesToken: overrides});
    }