Message.image constructor

const Message.image({
  1. required MessageID id,
  2. required UserID authorId,
  3. MessageID? replyToMessageId,
  4. @EpochDateTimeConverter() DateTime? createdAt,
  5. @EpochDateTimeConverter() DateTime? deletedAt,
  6. @EpochDateTimeConverter() DateTime? failedAt,
  7. @EpochDateTimeConverter() DateTime? sentAt,
  8. @EpochDateTimeConverter() DateTime? deliveredAt,
  9. @EpochDateTimeConverter() DateTime? seenAt,
  10. @EpochDateTimeConverter() DateTime? updatedAt,
  11. Map<String, List<UserID>>? reactions,
  12. bool? pinned,
  13. Map<String, dynamic>? metadata,
  14. MessageStatus? status,
  15. required String source,
  16. String? text,
  17. String? thumbhash,
  18. String? blurhash,
  19. double? width,
  20. double? height,
  21. bool? hasOverlay,
})

Creates an image message.

Implementation

const factory Message.image({
  /// Unique identifier for the message.
  required MessageID id,

  /// ID of the user who sent the message.
  required UserID authorId,

  /// ID of the message this one is replying to.
  MessageID? replyToMessageId,

  /// Timestamp when the message was created.
  @EpochDateTimeConverter() DateTime? createdAt,

  /// Timestamp when the message was marked as deleted.
  @EpochDateTimeConverter() DateTime? deletedAt,

  /// Timestamp when the message failed to send.
  @EpochDateTimeConverter() DateTime? failedAt,

  /// Timestamp when the message was successfully sent.
  @EpochDateTimeConverter() DateTime? sentAt,

  /// Timestamp when the message was delivered to the recipient.
  @EpochDateTimeConverter() DateTime? deliveredAt,

  /// Timestamp when the message was seen by the recipient.
  @EpochDateTimeConverter() DateTime? seenAt,

  /// Timestamp when the message was last updated.
  @EpochDateTimeConverter() DateTime? updatedAt,

  /// Map of reaction keys to lists of user IDs who reacted.
  Map<String, List<UserID>>? reactions,

  /// Indicates if the message is pinned.
  bool? pinned,

  /// Additional custom metadata associated with the message.
  Map<String, dynamic>? metadata,

  /// Status of the message. Takes precedence over the timestamp based status.
  /// If not provided, the status is determined by createdAt, sentAt, seenAt etc.
  MessageStatus? status,

  /// Source URL or path of the image.
  required String source,

  /// Optional text caption accompanying the image.
  String? text,

  /// ThumbHash string for a low-resolution placeholder.
  String? thumbhash,

  /// BlurHash string for a low-resolution placeholder.
  String? blurhash,

  /// Width of the image in pixels.
  double? width,

  /// Height of the image in pixels.
  double? height,

  /// Indicates if an overlay should be shown (e.g., for NSFW content).
  bool? hasOverlay,
}) = ImageMessage;