map method

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

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

Implementation

@override
NetworkAuditData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return NetworkAuditData(
    id: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}id'])!,
    createdAt: attachedDatabase.typeMapping
        .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
    totalDownload: attachedDatabase.typeMapping
        .read(DriftSqlType.double, data['${effectivePrefix}total_download'])!,
    totalUpload: attachedDatabase.typeMapping
        .read(DriftSqlType.double, data['${effectivePrefix}total_upload'])!,
    downloadSpeed: attachedDatabase.typeMapping
        .read(DriftSqlType.double, data['${effectivePrefix}download_speed'])!,
    uploadSpeed: attachedDatabase.typeMapping
        .read(DriftSqlType.double, data['${effectivePrefix}upload_speed'])!,
    isWifi: attachedDatabase.typeMapping
        .read(DriftSqlType.bool, data['${effectivePrefix}is_wifi'])!,
    isCellular: attachedDatabase.typeMapping
        .read(DriftSqlType.bool, data['${effectivePrefix}is_cellular'])!,
    isEthernet: attachedDatabase.typeMapping
        .read(DriftSqlType.bool, data['${effectivePrefix}is_ethernet'])!,
    wifiSsid: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}wifi_ssid']),
  );
}