SpeedTestService constructor
const
SpeedTestService({
- Client? client,
- PingService? pingService,
构造 SpeedTestService / Creates a SpeedTestService.
传入 client 时复用调用方的 HTTP 客户端且不会关闭它;为 null 时每次
测速内部创建并在结束时关闭客户端 / When client is provided it is reused
and never closed; otherwise a client is created per run and closed at the
end.
Implementation
const SpeedTestService({http.Client? client, PingService? pingService})
: _client = client,
_pingService = pingService ?? const PingService();