formData method

void formData(
  1. String path, {
  2. required FormData body,
  3. Map<String, String>? headers,
  4. String? contentType,
  5. bool withLoading = true,
  6. dynamic fromJson(
    1. Map<String, dynamic>
    )?,
  7. void onProgressChanged(
    1. int,
    2. int
    )?,
})

POST request with FormData content.

Perform a POST request to API with specific path and a formData as data.

Usefull for uploading files

You can specify the headers for request.

Implementation

void formData(
  String path, {
  required FormData body,
  Map<String, String>? headers,
  String? contentType,
  bool withLoading = true,
  dynamic Function(Map<String, dynamic>)? fromJson,
  void Function(int, int)? onProgressChanged,
}) =>
    add(
      RestEvent.formData(
        path,
        body: body,
        contentType: contentType,
        fromJson: fromJson,
        headers: headers,
        withLoading: withLoading,
      ),
    );