FileContent class

File content providing body and stream access for a file resource.

Inheritance

Constructors

FileContent(Uri reference, File file, {String? contentType, Encoding encoding = utf8, int? contentLength})
Create a file content of reference and file.

Properties

bytes Future<Uint8List>
Reads content body as bytes and returns a future of Uint8List.
no setteroverride
contentLength int?
An optional content length as number of bytes.
final
encoding Encoding
The expected charset encoding.
final
file File
The original file for this content.
final
hashCode int
The hash code for this object.
no setterinherited
mediaType → MediaType
The expected media type.
final
reference Uri
The URI reference to a resource this anchor is referring.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Future<Stream<List<int>>>
Returns a future for a single-subscription stream with content data.
no setteroverride
text Future<String>
Reads content body as text and returns a future of String.
no setteroverride

Methods

byteData([int start = 0, int? end]) Future<ByteData>
Reads content body as bytes and returns a future of ByteData.
override
byteStream() Stream<List<int>>
Returns content body as a single-subscription byte stream.
override
decodeJson({Object? reviver(Object? key, Object? value)?}) Future
Reads and decodes content body as a JSON object, returned in a future.
override
hasType(String primaryType, String subType0, [String? orSubType1, String? orSubType2, String? orSubType3, String? orSubType4]) bool
Checks if "content-type" equals with primaryType and one of sub types.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited