map method

  1. @override
VersionRow 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
VersionRow map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return VersionRow(
    userId: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}user_id'])!,
    favoriteChatsListVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}favorite_chats_list_version']),
    favoriteChatsSynchronized: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}favorite_chats_synchronized']),
    chatContactsListVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}chat_contacts_list_version']),
    favoriteContactsSynchronized: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}favorite_contacts_synchronized']),
    contactsSynchronized: attachedDatabase.typeMapping.read(
        DriftSqlType.bool, data['${effectivePrefix}contacts_synchronized']),
    blocklistSynchronized: attachedDatabase.typeMapping.read(
        DriftSqlType.bool, data['${effectivePrefix}blocklist_synchronized']),
    sessionsListVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.string, data['${effectivePrefix}sessions_list_version']),
    blocklistVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.string, data['${effectivePrefix}blocklist_version']),
    blocklistCount: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}blocklist_count']),
  );
}