string property

Future<String> get string

Returns the file contents decoded as UTF-8 text.

This is most useful for text-based uploads.

Example:

final textFile = UploadedFile.fromBytes(
  filename: 'notes.txt',
  bytes: Uint8List.fromList(utf8.encode('Hello world')),
  contentType: 'text/plain',
);

print(await textFile.string); // Hello world

Implementation

Future<String> get string async => utf8.decode(await _cachedBytes);