Message class

Constructors

Message({required String messageId, required String senderId, required String targetId, required Uint8List payload, required int status, required int createdAt, required int ttl, String? signature, required int mediaType, String? mediaFileName, String? mediaMimeType, int? mediaFileSize, String? mediaHash, String? mediaLocalPath, required int mediaAvailability, Uint8List? mediaThumbnail})
const
Message.fromJson(Map<String, dynamic> json, {ValueSerializer? serializer})
factory

Properties

createdAt int
Epoch milliseconds when the message was originally created.
final
hashCode int
The hash code for this object.
no setteroverride
mediaAvailability int
Availability state of the media binary on this device. See MediaAvailability. Defaults to 0 (notApplicable — text message).
final
mediaFileName String?
Original filename of the attached media (e.g., 'photo_001.jpg'). Null for text-only messages.
final
mediaFileSize int?
Size of the full media file in bytes. Used by the UI to display file size and decide auto-download.
final
mediaHash String?
SHA-256 hash of the full media file for integrity verification. Computed on send, verified on receive after FILE transfer.
final
mediaLocalPath String?
Local filesystem path to the downloaded media binary. Null until the binary is successfully transferred.
final
mediaMimeType String?
MIME type of the media (e.g., 'image/jpeg', 'video/mp4'). Null for text-only messages.
final
mediaThumbnail Uint8List?
Compressed thumbnail bytes (JPEG, ≤5 KB) for instant preview. Embedded directly in the epidemic sync payload so users see a preview even before the full file is transferred.
final
mediaType int
The type of media attached (0 = text, 1 = image, 2 = video, etc.). See MediaType. Defaults to 0 (text — no media).
final
messageId String
Globally unique message identifier (UUID v4).
final
payload Uint8List
The encoded message content (arbitrary bytes).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
senderId String
The originating node's ID.
final
signature String?
Optional HMAC-SHA256 signature for message integrity verification. Computed by MessageSigner when the message is created locally. Relaying nodes can verify the signature to detect tampering.
final
status int
Delivery status, stored as an integer mapping to MessageStatus.
final
targetId String
The destination node's ID. Use '*' for broadcast messages.
final
ttl int
Remaining hop budget. Decremented on each relay. When this reaches 0, the message is marked MessageStatus.expired.
final

Methods

copyWith({String? messageId, String? senderId, String? targetId, Uint8List? payload, int? status, int? createdAt, int? ttl, Value<String?> signature = const Value.absent(), int? mediaType, Value<String?> mediaFileName = const Value.absent(), Value<String?> mediaMimeType = const Value.absent(), Value<int?> mediaFileSize = const Value.absent(), Value<String?> mediaHash = const Value.absent(), Value<String?> mediaLocalPath = const Value.absent(), int? mediaAvailability, Value<Uint8List?> mediaThumbnail = const Value.absent()}) Message
copyWithCompanion(MessagesCompanion data) Message
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toColumns(bool nullToAbsent) Map<String, Expression<Object>>
Converts this object into a map of column names to expressions to insert or update.
toCompanion(bool nullToAbsent) MessagesCompanion
toJson({ValueSerializer? serializer}) Map<String, dynamic>
Converts this object into a representation that can be encoded with json. The serializer can be used to configure how individual values will be encoded. By default, DriftRuntimeOptions.defaultSerializer will be used. See ValueSerializer.defaults for details.
toJsonString({ValueSerializer? serializer}) String
Converts this object into a json representation. The serializer can be used to configure how individual values will be encoded. By default, DriftRuntimeOptions.defaultSerializer will be used. See ValueSerializer.defaults for details.
inherited
toString() String
A string representation of this object.
override

Operators

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