map method

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

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

Implementation

@override
TafsirTableData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return TafsirTableData(
    id: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}index'])!,
    surahNum: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}sura'])!,
    ayahNum: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}aya'])!,
    tafsirText: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}Text'])!,
    pageNum: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}PageNum'])!,
  );
}