fromFileSync static method

MultipartFileRecreatable fromFileSync(
  1. String filePath, {
  2. String? filename,
  3. MediaType? contentType,
})

Implementation

static MultipartFileRecreatable fromFileSync(
  String filePath, {
  String? filename,
  MediaType? contentType,
}) {
  filename ??= p.basename(filePath);
  final file = File(filePath);
  final length = file.lengthSync();
  final stream = file.openRead();
  return MultipartFileRecreatable(
    stream,
    length,
    filename,
    filePath,
    contentType: contentType,
  );
}