UploadedFile.fromBytes constructor
UploadedFile.fromBytes({})
Creates an uploaded file from an in-memory byte buffer.
This constructor caches the provided bytes immediately and stores their length for later access.
Example:
final file = UploadedFile.fromBytes(
filename: 'song.mp3',
bytes: Uint8List.fromList([0, 1, 2, 3]),
contentType: 'audio/mpeg',
);
Implementation
UploadedFile.fromBytes({required this.filename, required Uint8List bytes, required this.contentType}) : _cachedBytes = Future.value(bytes), _knownLength = bytes.length;