postSingleFileWithDataRequest<T> method

Future<HtpioResponse<T>> postSingleFileWithDataRequest<T>({
  1. required String endpoint,
  2. required String fileJsonKey,
  3. required File file,
  4. required Map<String, String>? data,
  5. required T fromJson(
    1. Map<String, dynamic>
    ),
})

Implementation

Future<HtpioResponse<T>> postSingleFileWithDataRequest<T>({
  required String endpoint,
  required String fileJsonKey,
  required File file,
  required Map<String, String>? data,
  required T Function(Map<String, dynamic>) fromJson,
}) async {
  Map<String, String> headers = {
    'Content-Type': 'multipart/form-data',
  };

  log('REQUEST TO : $endpoint');
  log('Headers: $headers');

  final request = HtpioRequest<T>(
    url: endpoint,
    method: 'POST',
    headers: headers,
    file: file,
    body: data,
    fromJson: fromJson,
  );

  return send(request);
}