copyWith method
Returns a copy of this file with updated metadata.
This preserves the same underlying file contents while allowing the filename and/or content type to be overridden.
Because the source bytes are stored asynchronously, this method is async.
Example:
final renamed = await file.copyWith(filename: 'cover.png');
print(renamed.filename); // cover.png
Implementation
Future<UploadedFile> copyWith({String? filename, String? contentType}) async {
return UploadedFile.fromBytes(filename: filename ?? this.filename, bytes: await _cachedBytes, contentType: contentType ?? this.contentType);
}