map method

  1. @override
Material 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
Material map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return Material(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    courseOffering: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}course_offering'],
    )!,
    title: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}title'],
    ),
    href: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}href'],
    ),
  );
}