Skip to content

Commit

Permalink
[postFile] add url parameter in postFile method
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritsz123 committed Jan 25, 2024
1 parent 071fc11 commit 03b47af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 6 additions & 1 deletion lib/src/api_service_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,18 @@ class ApiServiceImpl implements ApiService {
@override
Future<Response<T>> postFile<T>({
String? endpoint,
String? url,
String? keyName,
File? file,
ProgressCallback? onSendProgress,
ApiOptions? options,
Map<String, dynamic>? 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) {
Expand Down
14 changes: 8 additions & 6 deletions lib/src/base/api_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ abstract class ApiService {
ApiOptions? options,
});

Future<Response<T>> postFile<T>(
{String? endpoint,
String? keyName,
File? file,
ProgressCallback? onSendProgress,
Map<String, dynamic>? queryParameters});
Future<Response<T>> postFile<T>({
String? endpoint,
String? url,
String? keyName,
File? file,
ProgressCallback? onSendProgress,
Map<String, dynamic>? queryParameters,
});

void setBaseUrl(String baseUrl);

Expand Down

0 comments on commit 03b47af

Please sign in to comment.