init static method

dynamic init({
  1. required String baseUrl,
  2. Map<String, String>? headers,
  3. String? mockMappingsFile,
  4. bool applyMock = false,
  5. bool badCertificateCallbackEnabled = false,
  6. int connectionTimeoutInSeconds = 15,
})

Implementation

static init(
    {required String baseUrl,
    Map<String, String>? headers,
    String? mockMappingsFile,
    bool applyMock = false,
    bool badCertificateCallbackEnabled = false,
    int connectionTimeoutInSeconds = 15}) {
  // For HTTP Request
  TGRequest.defaultBaseUrl = baseUrl;
  TGRequest.defaultHeaders = headers;

  // For Mock
  TGMockService.applyMock = applyMock;
  if (mockMappingsFile != null && applyMock) {
    TGMockService.loadMockMappings(mockMappingsFile);
  }

  // For HTTP Client
  TGHttpClient.badCertificateCallbackEnabled = badCertificateCallbackEnabled;
  TGHttpClient.connectionTimeoutInSeconds = connectionTimeoutInSeconds;
}