post method

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

POST request to API

Perform a POST request to API with specific path and a body. You can send the headers, contentType and a fromJson method to parse the result json to a specific object.

Implementation

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