read<T> method

Expr<T> read<T>(
  1. Slot<T> slot
)

Resolves this declaration's slot without comparing source expressions.

Implementation

Expr<T> read<T>(Slot<T> slot) {
  final index = _indices[slot];
  if (index == null) {
    throw const OrmException(
      'PROJECTION.SLOT',
      'This projection did not export that slot.',
    );
  }
  final expression = _columns[index];
  if (expression.codec.valueType != T) {
    throw const OrmException(
      'PROJECTION.CODEC_TYPE',
      'Read the declared slot type; broadening it does not broaden its codec.',
    );
  }
  return Expr<T>.internal(
    expression.expressionNode,
    expression.codec as Codec<T>,
  );
}