post static method

Future<ResponseInfo> post(
  1. Uri uri,
  2. {Map<String, String>? data,
  3. List<FilePart>? fileParts,
  4. RequestInfo? requestInfo}
)

Makes a POST request to the given uri. The data is passed in the body of the request, using the content-type application/x-www-form-urlencoded.

if fileParts is provided and not empty, the request will be sent as a multipart request.

Implementation

static Future<ResponseInfo> post(
  Uri uri, {
  Map<String, String>? data,
  List<FilePart>? fileParts,
  RequestInfo? requestInfo,
}) {
  if (fileParts != null) {
    if (fileParts.isEmpty) {
      throw ArgumentError.value(
          fileParts, 'fileParts', 'fileParts must not be empty');
    }
    return _postMultiParts(uri, data, fileParts, requestInfo: requestInfo);
  }
  return _fetch(HttpOperation.post, uri,
      parameters: data, requestInfo: requestInfo);
}