map method

  1. @override
Syllabus 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
Syllabus map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return Syllabus(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    courseOffering: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}course_offering'],
    )!,
    teacher: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}teacher'],
    )!,
    updatedAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}updated_at'],
    ),
    objective: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}objective'],
    ),
    weeklyPlan: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}weekly_plan'],
    ),
    evaluation: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}evaluation'],
    ),
    textbooks: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}textbooks'],
    ),
    remarks: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}remarks'],
    ),
  );
}