getHttpClient static method

HttpClient getHttpClient()

Returns an HttpClient configured with a 10-second timeout and optional self-signed certificate trust.

Implementation

static HttpClient getHttpClient() {
  HttpClient httpClient = HttpClient()
    ..connectionTimeout = const Duration(seconds: 10)
    ..badCertificateCallback =
        ((X509Certificate cert, String host, int port) => trustSelfSigned);

  return httpClient;
}