map method

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

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

Implementation

@override
NotificationMessageData map(
  Map<String, dynamic> data, {
  String? tablePrefix,
}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return NotificationMessageData(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    title: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}title'],
    )!,
    message: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}message'],
    )!,
    createDateTime: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}create_date_time'],
    )!,
    read: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}read'],
    )!,
    type: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}type'],
    )!,
  );
}