spHttpRequest function

Future spHttpRequest({
  1. required HttpRequestType httpRequestType,
  2. required String path,
  3. dynamic payload,
})

Implementation

Future spHttpRequest({
  required HttpRequestType httpRequestType,
  required String path,
  dynamic payload,
}) async {
  switch (httpRequestType) {
    case HttpRequestType.get:
      return shurjoPayserviceLocator<SPDioService>().dio.get(
            path,
          );
    case HttpRequestType.post:
      return shurjoPayserviceLocator<SPDioService>().dio.post(
            path,
            data: payload,
          );
    case HttpRequestType.put:
      return shurjoPayserviceLocator<SPDioService>().dio.put(
            path,
            data: payload,
          );
    case HttpRequestType.delete:
      return shurjoPayserviceLocator<SPDioService>().dio.delete(
            path,
            data: payload,
          );
  }
}