map method

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

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

Implementation

@override
SalesOrderData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return SalesOrderData(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    orderDateTime: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}order_date_time'],
    )!,
    amount: attachedDatabase.typeMapping.read(
      DriftSqlType.double,
      data['${effectivePrefix}amount'],
    )!,
    taxAmount: attachedDatabase.typeMapping.read(
      DriftSqlType.double,
      data['${effectivePrefix}tax_amount'],
    )!,
    status: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}status'],
    )!,
    sellerId: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}seller_id'],
    )!,
    customerId: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}customer_id'],
    )!,
  );
}