map method

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

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

Implementation

@override
SalesOrderLineData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return SalesOrderLineData(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    salesOrderId: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}sales_order_id'],
    )!,
    productId: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}product_id'],
    )!,
    units: attachedDatabase.typeMapping.read(
      DriftSqlType.double,
      data['${effectivePrefix}units'],
    )!,
    amount: attachedDatabase.typeMapping.read(
      DriftSqlType.double,
      data['${effectivePrefix}amount'],
    )!,
    taxAmount: attachedDatabase.typeMapping.read(
      DriftSqlType.double,
      data['${effectivePrefix}tax_amount'],
    )!,
  );
}