YustFile class
A binary file handled by database and file storage. A file is stored in Firebase Storage and linked to a document in the database. For offline caching a file can also be stored on the device.
- Implementers
- Annotations
-
- @JsonSerializable.new(createFactory: false)
Constructors
-
YustFile({String? key, String? name, DateTime? modifiedAt, String? url, String hash = '', File? file, Uint8List? bytes, String? devicePath, String? storageFolderPath, String? linkedDocPath, String? linkedDocAttribute, bool processing = false, String? lastError, bool? createThumbnail, bool? linkedDocStoresFilesAsMap, DateTime? createdAt, String? path, Map<
YustFileThumbnailSize, String> ? thumbnails, bool favorite = false, bool setCreatedAtToNow = true}) - Creates a new file.
-
YustFile.fromJson(Map<
String, dynamic> json) -
Converts the file to JSON for Firebase. Only relevant attributes are converted.
factory
-
YustFile.fromLocalJson(Map<
String, dynamic> json) -
Converts the file to JSON for local device. Only relevant attributes are converted.
factory
Properties
- bytes ↔ Uint8List?
-
The binary file for web. For iOS and Android file is used instead.
getter/setter pair
- cacheable → bool
-
True if image can be stored in cache. Each cached file needs a name
no setter
- cached → bool
-
True if image is cached locally.
no setter
- createdAt ↔ DateTime?
-
Date and time when the file was created in univelop.
getter/setter pair
- createThumbnail ↔ bool?
-
True if a thumbnail should be created.
getter/setter pair
- devicePath ↔ String?
-
Path to the file on the device. Used for offline caching.
getter/setter pair
- favorite ↔ bool
-
Whether the file is marked as a favorite.
getter/setter pair
- file ↔ File?
-
The binary file. This attribute is used for iOS and Android. For web bytes is used instead.
getter/setter pair
- hash ↔ String
-
The md5 hash of the file.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasThumbnail → bool
-
Returns true if this file has a thumbnail
no setter
- key ↔ String?
-
getter/setter pair
- lastError ↔ String?
-
stores the last error. Used in offline caching
getter/setter pair
- linkedDocAttribute ↔ String?
-
Attribute of the Firebase document. Used for offline caching.
getter/setter pair
- linkedDocPath ↔ String?
-
Path to the Firebase document. Used for offline caching.
getter/setter pair
- linkedDocStoresFilesAsMap ↔ bool?
-
True if the files should be stored as a Map of hash and file
inside the linked document.
getter/setter pair
- modifiedAt ↔ DateTime?
-
The last modification time stamp.
getter/setter pair
- name ↔ String?
-
The name of the file with extension.
getter/setter pair
- path ↔ String?
-
The path to the file in the storage.
getter/setter pair
- processing ↔ bool
-
Is true while uploading the file.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- storageFolderPath ↔ String?
-
Path to the storage folder. Used for offline caching.
getter/setter pair
-
thumbnails
↔ Map<
YustFileThumbnailSize, String> ? -
The thumbnails of the file.
getter/setter pair
- url ↔ String?
-
The URL to download the file.
getter/setter pair
Methods
-
copyWithUrl(
String? url) → YustFile - Creates a new file with the same properties but with a new URL.
-
getFilenameExtension(
) → String - Returns the extension of the file.
-
getFileNameWithoutExtension(
) → String - Returns the file name without the extension.
-
getOriginalUrl(
) → String? - Returns the original URL of the file.
-
getThumbnailUrl(
{YustFileThumbnailSize size = YustFileThumbnailSize.normal}) → String? - Returns the thumbnail URL of the file.
-
isValid(
) → bool - Checks if the file has a valid name and url or path.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts JSON from Firebase to a file. Only relevant attributes are included.
-
toLocalJson(
) → Map< String, String?> - Converts JSON from device to a file. Only relevant attributes are included.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
YustFile file) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String key) → dynamic
Constants
- maxSizeInBytes → const int
- The hard upper limit for a single file yust uploads or downloads.