fromFile static method

Future<MultipartFile> fromFile(
  1. String filePath, {
  2. String? filename,
  3. DioMediaType? contentType,
  4. Map<String, List<String>>? headers,
})

Creates a new MultipartFile from a path to a file on disk.

filename defaults to the basename of filePath. contentType currently defaults to application/octet-stream, but in the future may be inferred from filename.

Throws an UnsupportedError if dart:io isn't supported in this environment.

Implementation

static Future<MultipartFile> fromFile(
  String filePath, {
  String? filename,
  DioMediaType? contentType,
  final Map<String, List<String>>? headers,
}) {
  return multipartFileFromPath(
    filePath,
    filename: filename,
    contentType: contentType,
    headers: headers,
  );
}