map method

  1. @override
UserRow 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
UserRow map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return UserRow(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}id'],
    )!,
    num: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}num'],
    )!,
    name: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name'],
    ),
    bio: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}bio'],
    ),
    avatar: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}avatar'],
    ),
    callCover: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}call_cover'],
    ),
    mutualContactsCount: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}mutual_contacts_count'],
    )!,
    online: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}online'],
    )!,
    presenceIndex: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}presence_index'],
    ),
    status: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}status'],
    ),
    isDeleted: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}is_deleted'],
    )!,
    dialog: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}dialog'],
    ),
    isBlocked: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}is_blocked'],
    ),
    lastSeenAt: $UsersTable.$converterlastSeenAtn.fromSql(
      attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}last_seen_at'],
      ),
    ),
    contacts: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}contacts'],
    )!,
    ver: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}ver'],
    )!,
    blockedVer: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}blocked_ver'],
    )!,
    welcomeMessage: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}welcome_message'],
    ),
  );
}