map method

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

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

Implementation

@override
CompanyData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return CompanyData(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    companyIdParent: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}company_id_parent'],
    ),
    code: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}code'],
    )!,
    name: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name'],
    )!,
    imagePath: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}image_path'],
    ),
    description: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}description'],
    ),
  );
}