auto static method

Request auto({
  1. required String endpoint,
  2. String? method,
  3. Set<Header>? headers,
  4. Map<String, dynamic>? body,
  5. List<MultipartFile> files = const [],
})

Implementation

static Request auto({
  required String endpoint,
  String? method,
  Set<Header>? headers,
  Map<String, dynamic>? body,
  List<MultipartFile> files = const [],
}) {
  return switch (files.isEmpty) {
    true => Request.json(
        endpoint: endpoint,
        body: body,
        headers: headers,
      ),
    false => Request.formData(
        endpoint: endpoint,
        body: body,
        files: files,
      ),
  };
}