readNullableWithType<T extends Object> method

  1. @optionalTypeArgs
T? readNullableWithType<T extends Object>(
  1. SqlType<T> type,
  2. String key
)

Interprets the column named key under the known drift type type.

Like readNullable, except that the type is fixed and not inferred from the type parameter T.

Implementation

@optionalTypeArgs
T? readNullableWithType<T extends Object>(SqlType<T> type, String key) {
  final index = _indexByName(key);

  return switch (row[index]) {
    null => null,
    var other => type.resolveIn(_db.dialect).dartValue(other),
  };
}