map method

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

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

Implementation

@override
Tile map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return Tile(
    id: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}id'])!,
    source: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}source'])!,
    z: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}z'])!,
    x: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}x'])!,
    y: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}y'])!,
    bytes: attachedDatabase.typeMapping
        .read(DriftSqlType.blob, data['${effectivePrefix}bytes'])!,
    etag: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}etag']),
    updatedAt: attachedDatabase.typeMapping
        .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!,
    lastAccessed: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime, data['${effectivePrefix}last_accessed'])!,
  );
}