getResponse abstract method

Future<Either<Response, FailureState>> getResponse({
  1. required String endPoint,
  2. required ApiMethods apiMethods,
  3. void unAuthorizedCallBack()?,
  4. Map<String, dynamic>? queryParams,
  5. dynamic body,
  6. Options? options,
  7. CacheConfig cacheConfig = const CacheConfig(),
  8. RetryConfig retryConfig = const RetryConfig(),
  9. bool hasInternet = true,
})

Executes an HTTP request and returns Either:

  • Left on success (HTTP 200/201 or cache hit)
  • Right on failure with a FailureState

unAuthorizedCallBack is optional. When null, the global callback registered via NetworkService.configureNetworkService is used instead.

Implementation

Future<Either<Response<dynamic>, FailureState>> getResponse({
  required String endPoint,
  required ApiMethods apiMethods,
  void Function()? unAuthorizedCallBack,
  Map<String, dynamic>? queryParams,
  dynamic body,
  Options? options,
  CacheConfig cacheConfig = const CacheConfig(),
  RetryConfig retryConfig = const RetryConfig(),
  bool hasInternet = true,
});