Attachment.fromRow constructor

Attachment.fromRow(
  1. Row row
)

Creates an Attachment instance from a database row.

row: The Row containing attachment data. Returns an Attachment instance populated with data from the row.

Implementation

factory Attachment.fromRow(Row row) {
  return Attachment(
    id: row['id'] as String,
    timestamp: row['timestamp'] as int? ?? 0,
    filename: row['filename'] as String,
    localUri: row['local_uri'] as String?,
    mediaType: row['media_type'] as String?,
    size: row['size'] as int?,
    state: AttachmentState.fromInt(row['state'] as int),
    hasSynced: (row['has_synced'] as int? ?? 0) > 0,
    metaData: row['meta_data']?.toString(),
  );
}