map method
Maps the given row returned by the database into the fitting data class.
Implementation
@override
ProductData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ProductData(
id: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}id'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
)!,
price: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}price'],
)!,
active: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}active'],
)!,
imagePath: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}image_path'],
),
categoryId: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}category_id'],
)!,
estimatedInputPrice: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}estimated_input_price'],
)!,
taxRate: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}tax_rate'],
)!,
description: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}description'],
),
);
}