map method

  1. @override
StoredCachedRow 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
StoredCachedRow map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return StoredCachedRow(
    accountKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}account_key'],
    )!,
    tableId: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}table_id'],
    )!,
    rowKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}row_key'],
    )!,
    valuesJson: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}values_json'],
    )!,
    updatedAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}updated_at'],
    )!,
  );
}