map method

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

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

Implementation

@override
AppUserData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return AppUserData(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    userName: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}user_name'],
    )!,
    email: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}email'],
    )!,
    fullName: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}full_name'],
    )!,
    encryptedPassword: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}encrypted_password'],
    )!,
    enabled: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}enabled'],
    )!,
    activated: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}activated'],
    )!,
    accessToken: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}access_token'],
    ),
    employeeId: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}employee_id'],
    ),
    lastActiveDatetime: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}last_active_datetime'],
    ),
    isSystemUser: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}is_system_user'],
    )!,
    imagePath: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}image_path'],
    ),
  );
}