CloudSyncable class
Represents an entity that can be synchronized between local and cloud storage.
- Available extensions
- Annotations
-
- @JsonSerializable(fieldRename: FieldRename.snake)
Constructors
- CloudSyncable.new({String? id, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, DateTime? localTimeSyncedAt, DateTime? serverTimeSyncedAt, String? localFilePath, String? remoteFilePath, DateTime? fileSyncedAt, String? timeOffset})
-
const
-
CloudSyncable.fromJson(Map<
String, dynamic> json) -
Creates a
CloudSyncable
object from a JSON map.factory
Properties
- createdAt → DateTime?
-
The time when the entity was created (local device timestamp).
final
- deletedAt → DateTime?
-
The time when the entity was deleted (local device timestamp,
null if not deleted).
final
- fileSyncedAt → DateTime?
-
The timestamp when the file was last synced (if applicable).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String?
-
A unique identifier for the entity.
final
- localFilePath → String?
-
The local file path of the entity (if applicable).
final
- localTimeSyncedAt → DateTime?
-
The local device timestamp when the entity was last synced
with the server.
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- remoteFilePath → String?
-
The remote file path of the entity (if applicable).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverTimeSyncedAt → DateTime?
-
The server timestamp when the entity was last synced with the server.
final
- stringify → bool?
-
If set to
true
, thetoString
method will be overridden to output this instance'sprops
.no setterinherited - timeOffset → String?
-
The timezone offset when the entity was created.
final
- updatedAt → DateTime?
-
The time when the entity was last updated (local device timestamp).
final
Methods
-
copyWith(
{String? id, DateTime? createdAt, DateTime? updatedAt, DateTime? localTimeSyncedAt, DateTime? serverTimeSyncedAt, DateTime? deletedAt, String? localFilePath, String? remoteFilePath, DateTime? fileSyncedAt, String? timeOffset}) → CloudSyncable - Creates a copy of this object with the given fields replaced with the new values.
-
copyWithNull(
{bool clearId = false, bool clearCreatedAt = false, bool clearUpdatedAt = false, bool clearLocalTimeSyncedAt = false, bool clearServerTimeSyncedAt = false, bool clearDeletedAt = false, bool clearLocalFilePath = false, bool clearRemoteFilePath = false, bool clearFileSyncedAt = false, bool clearTimeOffset = false}) → CloudSyncable - Creates a copy of this object with the specified fields set to null.
-
getFullLocalFilePath(
String appDir) → String? - Returns the full local file path of the journal entry.
-
isDeleted(
) → bool -
Returns
true
if the entity is marked as deleted. -
needsDataSync(
) → bool -
Returns
true
if the entity's data needs to be synchronized with the cloud. -
needsFileSync(
) → bool -
Returns
true
if the entity has a file that needs to be synced with the cloud. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this object to a JSON map.
-
toJsonForFirestore(
) → Map< String, dynamic> -
Available on CloudSyncable, provided by the FirestoreTimestamp extension
Converts the JSON representation of this CloudSyncable object to a Firestore-compatible format, converting any valid date-time strings to Firestore Timestamps. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited