NativeFile class

Native file representation.

Annotations

Constructors

NativeFile({required String name, required int size, String? path, Uint8List? bytes, Stream<List<int>>? stream, MediaType? mime, Size? dimensions})
NativeFile.fromJson(Map<String, dynamic> json)
Constructs a NativeFile from the provided json.
factory
NativeFile.fromPlatformFile(PlatformFile file)
Constructs a NativeFile from a PlatformFile.
factory
NativeFile.fromXFile(XFile file, int size)
Constructs a NativeFile from an XFile.
factory

Properties

bytes → Rx<Uint8List?>
Byte data of this file.
final
dimensions → Rx<Size?>
Size of the image this NativeFile represents, if isImage.
final
extension → String
Returns an extension of this file.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isImage → bool
Indicates whether this file represents an image or not.
no setter
isSvg → bool
Indicates whether this file represents an SVG or not.
no setter
isVideo → bool
Indicates whether this file represents a video or not.
no setter
mime ↔ MediaType?
MediaType of this file.
getter/setter pair
name → String
File name including its extension.
final
path → String?
Absolute path for a cached copy of this file.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → int
Size of this file in bytes.
final
stream → Stream<List<int>>?
Returns contents of this file as a broadcast Stream.
no setter

Methods

ensureCorrectMediaType() → Future<void>
Ensures mime is correctly assigned.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readFile() → Future<Uint8List?>
Reads this file from its stream and returns its bytes.
toJson() → Map<String, dynamic>
Returns a Map representing this NativeFile.
toMultipartFile() → Future<MultipartFile>
Converts the NativeFile to a MultipartFile.
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

images → const List<String>
Returns the extensions of files considered to be images.