HttpAdapter constructor

HttpAdapter({
  1. Client? client,
})

Creates an HttpAdapter.

创建 HttpAdapter。

Parameters / 参数:

  • client: Optional custom http.Client instance. If not provided, a default instance will be created. 可选的自定义 http.Client 实例。如果不提供,将创建默认实例。

Example / 示例:

// Using default client / 使用默认 client
final adapter = HttpAdapter();

// Using custom client / 使用自定义 client
final client = IOClient(HttpClient());
final adapter = HttpAdapter(client: client);

Implementation

HttpAdapter({http.Client? client}) : _client = client ?? http.Client();