get method

Future<Response?> get(
  1. String apiPath
)

Implementation

Future<Response?> get(String apiPath) async {
  Logger.log(
    "--------> START OF GET API CALL <--------",
    type: LogType.api,
    tag: "DF-API-CLIENT",
  );
  final client = http.Client();
  Uri apiUri = _generateApiUri(apiPath);
  return _processApiCall(
    httpApiConfig.maxRetryAttempts,
    apiCall: () async {
      return await client
          .get(apiUri, headers: httpApiConfig.headers)
          .timeout(
            Duration(seconds: httpApiConfig.timeout),
            onTimeout: () => throw Exception(
              "API Timeout exception, no response from the server for: $apiPath",
            ),
          );
    },
    onFinish: client.close,
  );
}