map method

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

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

Implementation

@override
AppUsageAuditData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return AppUsageAuditData(
    id: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}id'])!,
    createdAt: attachedDatabase.typeMapping
        .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
    date: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}date'])!,
    packageName: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}package_name'])!,
    totalTimeVisible: attachedDatabase.typeMapping.read(
        DriftSqlType.int, data['${effectivePrefix}total_time_visible'])!,
    totalTimeInForeground: attachedDatabase.typeMapping.read(DriftSqlType.int,
        data['${effectivePrefix}total_time_in_foreground'])!,
    totalTimeForegroundServiceUsed: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}total_time_foreground_service_used'])!,
  );
}