Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The new readWithConverter should perhaps be non-nullable? #2640

Closed
Adam-Langley opened this issue Sep 26, 2023 · 1 comment
Closed

The new readWithConverter should perhaps be non-nullable? #2640

Adam-Langley opened this issue Sep 26, 2023 · 1 comment

Comments

@Adam-Langley
Copy link

There is no 'as' operator in the implementation, so surely the result is expected to be non-nullable otherwise it will throw a runtime error?

  /// Reads a column that has a type converter applied to it from the row.
  ///
  /// This calls [read] internally, which reads the column but without applying
  /// a type converter.
  D? readWithConverter<D, S extends Object>(
      GeneratedColumnWithTypeConverter<D, S> column) {
    return column.converter.fromSql(read<S>(column));
  }
@simolus3
Copy link
Owner

It should return nullable values - the fact that it throws for nulls is a bug that has been fixed in 3ef468b. The reason is that even non-nullable columns can be null in that class because they could have been added from an outer join. read() returns nullable values for the same reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants