MultipartFileRecreatable.fromFileSync constructor

MultipartFileRecreatable.fromFileSync(
  1. String filePath
)

Creates a new MultipartFileRecreatable from a file specified by the filePath.

Implementation

factory MultipartFileRecreatable.fromFileSync(String filePath) {
  final file = File(filePath);
  final length = file.lengthSync();
  final stream = file.openRead();
  var name = file.path.split('/').last;

  return MultipartFileRecreatable(
    filePath,
    'file',
    stream,
    length,
    filename: name,
  );
}