map method

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

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

Implementation

@override
StoredRowState map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return StoredRowState(
    accountKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}account_key'],
    )!,
    tableId: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}table_id'],
    )!,
    rowKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}row_key'],
    )!,
    phase: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}phase'],
    )!,
    actionId: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}action_id'],
    ),
    attemptCount: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}attempt_count'],
    )!,
    nextRetryAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}next_retry_at'],
    ),
    errorCode: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}error_code'],
    ),
    errorMessage: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}error_message'],
    ),
    lastServerSeq: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}last_server_seq'],
    ),
    pendingValuesJson: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}pending_values_json'],
    ),
    tombstone: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}tombstone'],
    )!,
    updatedAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}updated_at'],
    )!,
  );
}