map method

  1. @override
ChatRow map(
  1. Map<String, dynamic> data, {
  2. String? tablePrefix,
})
override

Maps the given row returned by the database into the fitting data class.

Implementation

@override
ChatRow map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return ChatRow(
    id: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}id'])!,
    avatar: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}avatar']),
    name: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}name']),
    members: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}members'])!,
    kindIndex: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}kind_index'])!,
    isHidden: attachedDatabase.typeMapping
        .read(DriftSqlType.bool, data['${effectivePrefix}is_hidden'])!,
    muted: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}muted']),
    directLink: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}direct_link']),
    createdAt: $ChatsTable.$convertercreatedAt.fromSql(attachedDatabase
        .typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}created_at'])!),
    updatedAt: $ChatsTable.$converterupdatedAt.fromSql(attachedDatabase
        .typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}updated_at'])!),
    lastReads: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}last_reads'])!,
    lastDelivery: $ChatsTable.$converterlastDeliveryn.fromSql(attachedDatabase
        .typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}last_delivery'])),
    firstItem: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}first_item']),
    lastItem: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}last_item']),
    lastReadItem: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}last_read_item']),
    unreadCount: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}unread_count'])!,
    totalCount: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}total_count'])!,
    ongoingCall: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}ongoing_call']),
    favoritePosition: attachedDatabase.typeMapping.read(
        DriftSqlType.double, data['${effectivePrefix}favorite_position']),
    membersCount: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}members_count'])!,
    ver: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}ver'])!,
    lastItemCursor: attachedDatabase.typeMapping.read(
        DriftSqlType.string, data['${effectivePrefix}last_item_cursor']),
    lastReadItemCursor: attachedDatabase.typeMapping.read(
        DriftSqlType.string, data['${effectivePrefix}last_read_item_cursor']),
    recentCursor: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}recent_cursor']),
    favoriteCursor: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}favorite_cursor']),
  );
}