From 03b47af2580d553616b6c3f54c8436010907eae8 Mon Sep 17 00:00:00 2001 From: Ritesh Khadse Date: Thu, 25 Jan 2024 17:39:36 +0530 Subject: [PATCH] [postFile] add url parameter in postFile method --- lib/src/api_service_impl.dart | 7 ++++++- lib/src/base/api_service.dart | 14 ++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/src/api_service_impl.dart b/lib/src/api_service_impl.dart index d51cbb1..4630528 100644 --- a/lib/src/api_service_impl.dart +++ b/lib/src/api_service_impl.dart @@ -104,13 +104,18 @@ class ApiServiceImpl implements ApiService { @override Future> postFile({ String? endpoint, + String? url, String? keyName, File? file, ProgressCallback? onSendProgress, ApiOptions? options, Map? queryParameters, }) async { - endpoint = endpoint != null ? "$baseUrl$endpoint" : getFileUploadUrl(); + // if the endpoint is not passed use url parameter + // if both of them are null then use default fileUploadUrl + + endpoint = + endpoint != null ? "$baseUrl$endpoint" : url ?? getFileUploadUrl(); if (queryParameters != null) { var queryUrl = ""; for (final parameter in queryParameters.entries) { diff --git a/lib/src/base/api_service.dart b/lib/src/base/api_service.dart index 8a2b3e0..e488ef2 100644 --- a/lib/src/base/api_service.dart +++ b/lib/src/base/api_service.dart @@ -30,12 +30,14 @@ abstract class ApiService { ApiOptions? options, }); - Future> postFile( - {String? endpoint, - String? keyName, - File? file, - ProgressCallback? onSendProgress, - Map? queryParameters}); + Future> postFile({ + String? endpoint, + String? url, + String? keyName, + File? file, + ProgressCallback? onSendProgress, + Map? queryParameters, + }); void setBaseUrl(String baseUrl);